Troubleshooting

Diagnosing the Causes of Unexpected Results from Location Paths

When a location path points to either a wrong node or non-existent node, I receive unexpected results. How can I discover the source of the problem?

Although the abbreviated path syntax offered by XPath saves you a lot of typing and makes the paths more readable, it also hides what’s really going on, which can cause confusion. Also, if the current context node provided by the application isn’t what you expect, things might not work as planned.

Try (either in your head, on paper, or in the actual expression you’re using) expanding your abbreviated paths to use the full syntax, with every / separated step consisting of an axis, a name or node type, and optionally ...

Get Special Edition Using XSLT now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.