xsl-list
[Top] [All Lists]

Re: characters in xsl

2004-11-11 15:11:16


'//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.

No. The top level element is a child of the document root node / (which
is not an element) //stone selects all elements called stone.

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'.

If you are talking of match patterns you can't use descendant-or-self::


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.

XPath doesn't have a "root element" only teh document root which encodes
the whole document not its top level element.

David


________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--