I think it'd would be better, if you just writw the node as //somenode. That allows some mistakes and changes and it goes straight the address you wanted.
I am thinking more in terms of performance and good practice though. Does the XSLT processor find a node more quickly with the first method or is it indistinguishable?
The x-path expression "//musician" forces the parser to check if a musician-node exitst in:
- library
- books
- (every) book
- writer
- cds
- (every) cd
The x-path expression "library/cds/cd/musician" forces the parser to check if a musician-node exitst in:
- (every) library/cds/cd
You bet there is a difference in performance, depending on the number of books you have.
As for good practice: suppose the xml is a bit more complicated:
XPath isn't terribly efficient anyway -- it (usually) does a straight linear search, so if your document gets over 1000 "records" you'll see search time skyrocket.
Chip H.
____________________________________________________________________ If you want to get the best response to a question, please read FAQ222-2244 first
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.