[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Trouble using recursion to make a Counter
This was beautiful, thank you. Served my purpose very well. This data was really just sample data, I tried to simplify what I had, but I appreciate the responses about design issues, always interested in another opinion. Thanks Mukul Gandhi, very intuitive answer. Mukul Gandhi <mukul_gandhi@yah To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx oo.com> cc: Subject: Re: Trouble using recursion to make a Counter 07/29/2004 10:47 PM Please respond to xsl-list Here is a another solution - <?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="text" /> <xsl:template match="/"> <xsl:for-each select="descendant::*[contains(name(),'Desc')]"> <xsl:value-of select="position()" /><xsl:text> </xsl:text><xsl:value-of select="." /> <xsl:text>
</xsl:text> </xsl:for-each> </xsl:template> </xsl:stylesheet> Regards, Mukul > I have data that looks like this: > > <level1> > <Level1Desc>Neighborhood</Level1Desc> > <Level1ID>1</Level1ID> > <Level2> > <Level2Desc>Street</Level2Desc> > <Level2ID>100</Level2ID> > <Level3> > <Level2Desc>House</Level2Desc> > <Level2ID>1000</Level2ID> > </Level3> > <Level3> > <Level2Desc>Condo</Level2Desc> > <Level2ID>1001</Level2ID> > </Level3> > </Level2> > <Level2> > <Level2Desc>Park</Level2Desc> > <Level2ID>101</Level2ID> > </Level2> > </level1> > > There are many level 1s in my data. > > So the end result of the processing would look > something like > > 1 Neighborhood > 2 Street > 3 House > 4 Condo > 5 Park __________________________________ Do you Yahoo!? Yahoo! Mail - Helps protect you from nasty viruses. http://promotions.yahoo.com/new_mail
|
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
|