Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X
We have multiple doctypes with different top level tags but every top level tag has identical attributes that control gentext for specific elements. For example:
<handbook role="template">...<name>[...]</name>...</handbook>
<handbook role="document">...<name>...</name>...</handbook>
<brochure role="template">...<name>[...]</name>...</brochure>
<brochure role="document">...<name>...</name>...</brochure>
Where the [ and ] in the template lines are gentext.
I can implement the condition on the name element as two attribute tests of ancestor = handbook, attribute = role, comparison = template andancestor = brochure, attribute = role, comparison = template and connect those two attribute tests with an OR boolean, but I could also implement as a more concise singlexpath rule of /*[role="template"]. Also note that I have many more doctypes other than handbook and brochure, so the maintenance becomes difficult as we add new doctypes and have to go back and add the new attribute tests.
i also know that xpath is not all that fast in Arbortext, at least in some situations. So is there any significant performance penalty by using the xpath test vs the attribute tests as described?
Thanks,
Steve
Thanks, Clay, that's what I was thinking. I believe we were using xpath in past versions of the //*[@role='template'] variety and that caused performance issues which lead to a wholesale rejection of xpath in this shop. The other potential problem I see is that the //* construct should return a node-list rather that a specific node, so the composition engine would have to take the first node from the node-list and throw away the rest. I would assume that the node-list would be in document order which would still return the root, but if the root didn't have role specified you could get all sorts of unexpected results.
Steve