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

Re: Choosing the a specific following node

Subject: Re: Choosing the a specific following node
From: David Carlisle <davidc@xxxxxxxxx>
Date: Fri, 15 Oct 2004 12:29:26 +0100
xsl following node
You haven't really posted enough of your stylesheet to explain the
behaviour that you get.


<xsl:template match="term[string(.)='s' or string(.)='s.']">
That's OK althouth you could write it as
<xsl:template match="term[.='s' or .='s.']">
as comparing nodes to strings always uses the string value.

However
		<xsl:variable name="pos" select="position()+2"/>

It's impossible to say what $pos will be here (and so how the rest of
the template behaves).

As mentioned often on this list (eg yesterday) position() never relates
to the position of a node in the source tree, only to its position in
the current node list, which in this case means it depends on the select
attribute of the xsl:apply-templates that causes this template to fire.

For example, just looking at the first keyword element.

if it had <xsl:apply-templates select="term[.='s.']"/>
then position() would be 1 and $pos 3

if it had <xsl:apply-templates select="term"/>
then position() would be 2 and $pos 4

if it had <xsl:apply-templates/>
then position() would be 6 and $pos 8 (because of the white space text
nodes between each child element of keyword) unless keyword was listed
in <xsl:strip-space elements="keyword" in which case it would act as


if it had <xsl:apply-templates select="*"/>
then position() would be 3 and $pos 5


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
________________________________________________________________________

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.