|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Choosing the a specific 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 ________________________________________________________________________
|
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








