Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old April 16th, 2004, 10:33 AM
Authorized User
Join Date: Jan 2004
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to rathbird
Default using preceding-sibling in apply-templates subset

I'm using apply-templates to get a subset of my nodes. Then I'm using the position() function to get my position within the subset, which is working fine. Then I try to use that position() to get the value of the previous node: position()-1, but instead of looking within my subset, it goes out to the entire xml and starts looking starting at the root node. How do I find the value of the previous node when I'm within a subset of nodes?

First I did a template match:
<xsl:template match="my:Criteria" mode="xd:preserve">

Then I wanted to check if a value I have in the current context node is the same as the value I had in the previous context node:

<xsl:value-of select="preceding-sibling::my:Criteria/my:Level2"/>,

but although my:Level2 DOES change, the output from this statement never changes. It always seems to be going back to the parent data instead of the subset I have within my template match. This is driving me crazy, and any help would be most appreciated!

Similar Threads
Thread Thread Starter Forum Replies Last Post
preceding-sibling::comment() bonekrusher XSLT 11 October 1st, 2008 11:38 AM
Using preceding-sibling mcanne98 Infopath 0 September 11th, 2008 11:09 PM
preceding-sibling descendant xaun XSLT 3 February 28th, 2006 02:48 PM
preceding-sibling jonesyp XSLT 2 November 22nd, 2005 12:29 PM
preceding-sibling behaviour andrewcday XSLT 6 December 3rd, 2004 03:24 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.