[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re:
Please try the following XSL - <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:xalan="http://xml.apache.org/xalan" exclude-result-prefixes="xalan"> <xsl:output method="text" version="1.0" encoding="UTF-8" indent="yes"/> <xsl:template match="/GROUP"> <xsl:variable name="RTF"> <xsl:for-each select=".//STEP1"> <xsl:if test="not(preceding-sibling::TITLE[1]='Raging River')"> <x> <xsl:value-of select="."/> </x> </xsl:if> </xsl:for-each> </xsl:variable> <xsl:for-each select="xalan:nodeset($RTF)/x"> <xsl:value-of select="position()" />. <xsl:value-of select="." /> </xsl:for-each> </xsl:template> </xsl:stylesheet> A nodeset function was required to generate the numbering 1,2,3,4 . Regards, Mukul --- tsterlin@xxxxxxxxxxxxxxxxx wrote: > Hello, > I'm attempting to produce an HTML document from > an XML one using XSLT. I > need to make a numbered list of a certain > tag's(<ITEM>) info contained within > the XML document. This challenge here is that I > only want certain <ITEM>s to > be contained in my list while others should be > omitted, however all <ITEM>s > have the same ancestry. The only distinguishing > element is a sibling tag known > as <TITLE> with different literal values stored in > them. It is the value > stored in this <TITLE> that needs to determine the > <ITEM>'s inclusion to or > exclusion from the list: > > <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> > <PARA0> > <TITLE>Raging River</TITLE> > <STEP1> > <ITEM>I don't want this item.</ITEM> > </STEP1> > <STEP1> > <ITEM>I don't want this item either.</ITEM> > </STEP> > </PARA0> > <PARA0> > <TITLE>Spectacular Sky</TITLE> > <STEP1> > <ITEM>This is the third item.</ITEM> > </STEP1> > <STEP1> > <ITEM>This is the fourth item.</ITEM> > </STEP1> > </PARA0> > </GROUP> > > ---------------The HTML output should be as follows: > 1. This is the first item. > 2. This is the second item. > 3. This is the third item. > 4. This is the fouth item. > > Any ideas? > > > > > > > > XSL-List info and archive: > http://www.mulberrytech.com/xsl/xsl-list > ________________________________________________________________________ Yahoo! India Insurance Special: Be informed on the best policies, services, tools and more. Go to: http://in.insurance.yahoo.com/licspecial/index.html 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
|