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

RE: select nodes only one level with same name

Subject: RE: select nodes only one level with same name
From: Mark Birbeck <Mark.Birbeck@xxxxxxxxxxxxx>
Date: Mon, 24 May 1999 17:17:28 +0100
xsl select node name
There are a number of ways. One is to nest your template tags:

<xsl:template match="/">
    <xsl:apply-templates>
        <xsl:template match="operation">
            do something for level 1 ...
            <xsl:apply-templates>
                <xsl:template match="operation">
                    before doing something for level 2
                </xsl:template>
            </xsl:apply-templates>
        </xsl:template>
    </xsl:apply-templates>
</xsl:template>

This will match a level 1 operation tag, then all of its child operation
tags, before moving on to the next level 1 tag. However, if you want all
level 1 operation tags to be processed before you match all level 2
operation tags, then do:

<xsl:template match="operation">
    don't do another apply-templates here
</xsl:template>

<xsl:template match="/">
    <xsl:apply-templates select="operation">
    </xsl:apply-templates>

    <xsl:apply-templates select="operation/operation">
    </xsl:apply-templates>
</xsl:template>

Regards,

Mark


> -----Original Message-----
> From: xsl-list@xxxxxxxxx 
> Sent: 24 May 1999 16:00
> To: undisclosed-recipients
> Subject: select nodes only one level with same name
> 
> 
> hi*
> 
> Example of xml:
> 
> <rootnode>
> <operation>
> 	bla-bla-bla...
> 	<operation>
> 		another bla-bla-bla...
> 	</operation>
> 	another bla-bla-bla again
> </operation>
> 
> Example of xsl:
> 
> 
> <xsl:template match="/">                                      
>                        
> bla-bla...
> <xsl:apply-templates select="I want to select first operation node">
> bla-bla-...
> <xsl:apply-templates select="I want to second level operation node">
> </xsl:template>
> 
> How can I do it?
> Thanks.
> Eugeny.
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.