About Arbortext Styler > Arbortext Styler Dialog Boxes > XPath Test Dialog Box
  
XPath Test Dialog Box
The XPath Test dialog box opens when you carry out one of the following actions in the Condition dialog box while creating a condition for an element or a table of contents (TOC):
Elect to create a new XPath test for the condition by clicking the New XPath Test button.
Select to edit an existing XPath test for a condition by highlighting the existing XPath test and clicking the Edit button.
In this dialog you can create a test based on the result of an XPath expression. Using XPath extension functions provided by PTC Arbortext, your XPath expression can invoke JavaScript or ACL scripting. Please refer to Accessing Scripts from Arbortext Styler for more information.
The title of the dialog box will be either New XPath Test or Edit XPath Test, depending on the operation you used to invoke the dialog box.
* 
You must understand XPath and its syntax to use this option. Refer to the World Wide Web Consortium (W3C) web site (www.w3.org/TR/xpath) for information on the XPath standard.
The XPath Test dialog box contains the following option:
Enter an XPath expression - enter an XPath expression to test. You must enter a valid XPath expression: if the XPath expression is invalid, Arbortext Styler will display an error message when you try to close the dialog box.
If you are creating an XPath test for a TOC condition, the XPath expression you enter here will be evaluated for each title being considered for inclusion in the TOC, with the title forming the context node for the purposes of evaluation.
* 
If you enter the name of a namespaced element in this field, you will not be prompted to declare the namespace if it does not already exist. Ensure you have declared the namespace for the stylesheet by creating an element with the applicable prefix, or the XPath expression you enter in this field will not be valid.
Avoid using the XPath functions position() or last() since they are not valid in this context. Some alternatives are given below:
Instead of position(), use count(preceding-sibling::*)+1
To test whether an element is the last child of its parent, that is to test position() = last(), use count(following-sibling::*) = 0
To test whether an element is the first child of its parent, use count(preceding-sibling::*) = 0
The use of certain XPath expressions can cause increased processing times. Please refer to XPath Performance for information and suggested alternatives.