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(_at_)yah To:
xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
oo.com> cc:
Subject: Re: [xsl] 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
--+------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--+--