Reputation: 551
which one give better performance when we handling XML with XSLT
XPath Axes (i.e. parent,attribute,child.....) or Location Path Expression (i.e. ./.., ./@attribute ,./childnode,... )
Please help me which one is give more performance and safe to use..
Upvotes: 1
Views: 519
Reputation: 243549
Borodin's answer is almost correct.
While the given expressions have the same efficiency, their are some subtle differences in the syntax rules of using them.
For example:
.[someCondition]
..[someCondition]
are invalid XPath 1.0 expressions and any compliant XSLT 1.0 processor raises a compile-time error. These are legal in XPath 2.0.
In Xpath 1.0 one should use these, syntactically legal expressions:
self::node()[someCondition]
parent::node()[someCondition]
Upvotes: 2
Reputation: 9627
I'm not sure but if you have performance issues (and it was not only a theoretical question) you should have a look to <xsl:key..
and select="key..
. This can speed up transformation a lot depending on requirements and complexity.
Upvotes: 0
Reputation: 126752
They are identical. Most axes can be selected only using the full form, but there are abbreviations for the most common ones that make an XPath expression more concise.
child::
may be omitted
//
== descendant-or-self::node()
@
== attribute::
.
== self:node()
..
== parent::node()
Upvotes: 3