In "Add/Change attribute" refactoring, support value XPath expressions
Posted: Wed Mar 01, 2023 8:22 pm
Let's say I have a table like this:
I would like each row to have an @id value equivalent to its first-column value, so it can be specifically referenced.
It would be great if the Add/Change attribute refactoring operation had a "Evaluate value as XPath" that would evaluate the given value using the XPath 3.0 xsl:evaluate() function. Then, I could run the refactoring operation to set the @id attribute, with the value specified as
Special characters could be handled, if needed:
In our actual DITA content, we have multiple such .dita topic files of error message tables, each with many (potentially hundreds) of rows. If the refactoring operation had such a feature, it would be trivial to process the entire set in one refactoring operation on the selected resources.
A sample DITA topic file is attached:
I would like each row to have an @id value equivalent to its first-column value, so it can be specifically referenced.
It would be great if the Add/Change attribute refactoring operation had a "Evaluate value as XPath" that would evaluate the given value using the XPath 3.0 xsl:evaluate() function. Then, I could run the refactoring operation to set the @id attribute, with the value specified as
Code: Select all
string(entry[1])
Code: Select all
string(entry[1]) => replace("[^-.A-Za-z0-9_:]+", "_")
A sample DITA topic file is attached: