|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: position() oddity?
Peter Flynn wrote:
> Given test.xml
> [...]
> what would you expect position() in template match "headers/title" to
> return?
It depends entirely on how the template was invoked.
('match="headers/title"'; is a red herring; the template's
match expression doesn't affect the context node position
in any way.)
> Currently it returns 2 4 6 8 10 using test.xsl (appended) when
> run through xt and cocoon. It's not quite what I expected (1 2 3 4 5 :-)
In this case, the template in question is invoked by
an <xsl:apply-templates/> instruction when the context node
is the 'headers' element. <xsl:apply-templates/> is shorthand
for <xsl:apply-templates select="child::node()"/>, so the context
node list contains all the children of the <headers> element,
namely, an alternating sequence of text nodes (containing whitespace)
and <title> element nodes.
<xsl:strip-space elements="header"/> should give the expected answer,
as will <xsl:apply-templates select="child::title"/>.
--Joe English
jenglish@xxxxxxxxxxxxx
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








