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

Re: position() oddity?

Subject: Re: position() oddity?
From: Joe English <jenglish@xxxxxxxxxxxxx>
Date: Wed, 28 Feb 2001 20:15:19 -0800
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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

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.
Email
First Name
Last Name
Company
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.