RE: HTML RANDOM NODE LIST
You may need to provide the more complex structure that you are working with. If you are in a template match for ITEM, then TITLE is not a sibling, so the preceding-sibling will axis will not include the TITLE node. TITLE is also not an ancestor of ITEM. You can see that by simply typing a path to the ITEM, GROUP/PARA0/STEP1/ITEM. In the XML you provided: <GROUP> <PARA0> <TITLE>Magic Mountains</TITLE> <STEP1> <ITEM>This is the first item.</ITEM> </STEP1> <STEP1> <ITEM>This is the second item.</ITEM> </STEP1> </PARA0> ... <snip/> ... </GROUP> You can find the TITLE associated from the context of an ITEM node using: ../../TITLE preceding::TITLE If there are more ancestor nodes between ITEM and TITLE, then perhaps in your real scenario the preceding axis is what is called for? <xsl:template match="/"> <ol> <xsl:apply-templates/> </ol> </xsl:template> <xsl:template match="ITEM"> <xsl:if test="not(preceding::TITLE='Raging River')"> <li><xsl:value-of select="."/></li> </xsl:if> </xsl:template> <xsl:template match="text()"/> Does that help? Josh -----Original Message----- From: tsterlin@xxxxxxxxxxxxxxxxx [mailto:tsterlin@xxxxxxxxxxxxxxxxx] Sent: Friday, February 20, 2004 10:20 AM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: HTML RANDOM NODE LIST Josh, the problem with that method is that the real XML document is much larger with a multitude of different tags and tag levels. The info contained within the tags must be output in a linear fashion so I cannot process it with for-each loops, I have to use nested/recursive template matches. It is within the "template-match" for ITEM, the lowest element in the document, that I must somehow discern between the ITEM's ancestor TITLE's literal value to determine whether it should be included within my numbered list. The parameters for things like count() and position() are all node sets, and I cannot use a test such as:"not(preceding-sibling::TITLE='Raging River')" to accumulate count or position. I'm stumped. Tracy. XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list 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