[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: characters in xsl

Subject: Re: characters in xsl
From: Geert Josten <Geert.Josten@xxxxxxxxxxx>
Date: Thu, 11 Nov 2004 18:39:42 +0100
Re:  characters in xsl
Hi Peter,

As David explained, "//stone" is short syntax for (long syntax) "/descendant-or-self::node()/child::stone", which translates into English as "any 'stone' element that is the child of some node that is the descendant of the root, or of the root itself". That is, all 'stone' elements in the document.

I hope the following is not going to confuse you, but using // sometimes results in unexpected results, especially if you are not aware of some details. Some have been mentioned by other, but I gathered them here for completeness:

'//stone' is a 'better match' in the sense that it is more specific. It will not match the root element if its name would be stone. Thus not all 'stone' elements in the document, but all _child_ elements (= elements that have a parent) named 'stone'. It works in fact the same as './/stone', where the current element will not be included if it happened to be a 'stone' element as well.

To match or select the root element if it is stone, use '/stone'. To match any element stone, just use 'stone'. To access any stone element in the document, even the root, (at any moment during the transformation), use '/descendant-or-self::stone'.

In short: it usually doesn't make sense to use // in match patterns. And keep in mind that //stone in select patterns don't include the root element.


Current Thread


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.