[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Trouble using recursion to make a Counter

Subject: Re: Trouble using recursion to make a Counter
From: Mukul Gandhi <mukul_gandhi@xxxxxxxxx>
Date: Thu, 29 Jul 2004 20:47:30 -0700 (PDT)
make counter
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>&#xA;</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

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.