[thelist] [XSL] Testing the next element

Howard Cheng howcheng at ix.netcom.com
Wed Oct 16 17:43:00 CDT 2002


Hi all,

I've got a conundrum here. I have an XML document like such:

<categories>
         <category id="1">text</category>
         <category id="2">text</category>
         <category id="3" selected="true">text</category>
         <category id="4">text</category>
</categories>

In my XSL I want to be able to test the attribute the following element,
like such:

<xsl:template match="category">
         <xsl:value-of select="text()"/>
         <xsl:if test="[next element is selected]">
                 <img src="..."/>
         </xsl:if>
</xsl:template>

But I can't figure out the XPath. I've tried:

following-sibling::node()[position()=position()+1]/@selected='true'
../*[position()=position()+1]/@selected='true'

But neither of them work. Any ideas?

Thanks in advance.

::::::::::::::::::::::::::::::::::
Howard Cheng
http://www.howcheng.com/ <-- NEW!
howcheng at ix dot netcom dot com
AIM: bennyphoebe
ICQ: 47319315




More information about the thelist mailing list