[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
Hi Ted,
...
You need to remember two things here. First, XPath expressions normally return node-sets. Second, node-sets are processed in document order. So your select expression is returning the first member of the set "preceding-sibling::attribute/@name", which is always the first in document order. But if you put a positional predicate in as part of an XPath step then that is applied in the order of the current axis, so try
<p>preceding sibling = <xsl:value-of select="preceding-sibling::attribute[1]/@name" /></p>
Hope this helps -
Francis.
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Re: [xsl] preceding-sibling inside for-each appears to fail
Subject: Re: [xsl] preceding-sibling inside for-each appears to fail From: Francis Norton <francis@xxxxxxxxxxx> Date: Sun, 09 Feb 2003 22:35:40 +0000 |
Hi Ted,
Ted Stresen-Reuter wrote: ...
<p>preceding sibling = <xsl:value-of select="preceding-sibling::attribute/@name" /></p>
...
As you can see, following-sibling successfully returns the following sibling, but preceding-sibling always returns the first node rather than the preceding-sibling node.
You need to remember two things here. First, XPath expressions normally return node-sets. Second, node-sets are processed in document order. So your select expression is returning the first member of the set "preceding-sibling::attribute/@name", which is always the first in document order. But if you put a positional predicate in as part of an XPath step then that is applied in the order of the current axis, so try
<p>preceding sibling = <xsl:value-of select="preceding-sibling::attribute[1]/@name" /></p>
Hope this helps -
Francis.
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] preceding-sibling inside for-, Ted Stresen-Reuter | Thread | Re: [xsl] preceding-sibling inside , Ted Stresen-Reuter |
RE: [xsl] Problems copying elements, Michael Kay | Date | RE: [xsl] Problems copying elements, Imrran Wahid |
Month |
Keywords