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

RE: Node selection based on parent attribute

Subject: RE: Node selection based on parent attribute
From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx>
Date: Fri, 30 Aug 2002 23:15:31 +0100
xsl value of parent attribute
> If I use:
> <xsl:template match="tree">
>   <xsl:apply-templates select="menu"/>
> </xsl:template>
> 
> <xsl:template match="menu">
>    <xsl:for-each select="menu[@id=$id]/menu">
>          <xsl:value-of select="@id"/>
>     </xsl:for-each>
> </xsl:template>

The for-each expands to

<xsl:for-each select="child::menu[@id=$id]/child::menu">

In other words, you are processing menu elements that are grandchildren
of the menu matched by the template rule. But none of your menu elements
have menu grandchildren...

Michael Kay
Software AG
home: Michael.H.Kay@xxxxxxxxxxxx
work: Michael.Kay@xxxxxxxxxxxxxx 

> 
> 
> with an xml structure of :
> 
> <tree>
>   <menu id="1" countryID="1" description="Com site" href="">
>       <menu id="4" countryID="1" description="My Buisness Type" 
> href=""></menu>
>       <menu id="5" countryID="1" description="Home Office" 
> href=""></menu>
>       <menu id="15" countryID="1" description="Small buisness" 
> href=""></menu>
>   </menu>
> </tree>
> 
> passing through a parameter of 1 using:
> <xsl:param name="id" select="menu"/>
> 
> Then it doesn't bring back anything, can you see anthing 
> wrong with the 
> above.
> 
> Cheers,
> 
> 
> >From: ronald heller <ronald@xxxxxxxxxxx>
> >Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> >To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> >Subject: Re:  Node selection based on parent attribute
> >Date: Fri, 30 Aug 2002 14:45:37 +0200
> >
> >
> >><menu id=6>
> >>         <menu id=7/>
> >>         <menu id=8/>
> >></menu>
> >
> ><xsl:for-each "menu[@id=$id]/menu">
> ><xsl:value-of select="@id"/>
> ></xsl:for-each>
> >
> >this would get you 7 & 8 as a result if $if would be 6.
> >
> >cheers
> >RH
> >At 12:32 PM 30-08-02 +0000, you wrote:
> >
> >>Hi,
> >>I would like to produce a list of child nodes from a parent 
> that has a
> >>specific attribute value, ie with the following xml 
> structure I want to 
> >>just retrive the children of the menu node with an id of 6.
> >><menu id=6>
> >><menu id=7/>
> >><menu id=8/>
> >></menu>
> >><menu id=9>
> >><menu id=10/>
> >><menu id=11/>
> >></menu>
> >>
> >>I have tried
> >><xsl:for-each "../@id=$id">
> >><xsl:value-of select="@id"/>
> >></xsl:for-each>
> >>Using a param passed in from asp.
> >>Am I on the right track, and would the above method be the best to
> >>retrieve a certain section of a heirachacal xml structure 
> based on a 
> >>parent attribute.
> >>I am using asp with the msxml parser.
> >>Thanks in advance.
> >>
> >>
> >>
> >>
> >>
> >>_________________________________________________________________
> >>Send and receive Hotmail on your mobile device: 
http://mobile.msn.com
>>
>>
>>XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>
>Salience B.V.
>"The XML place to be"
>Coltbaan 27b
>3439 NG Nieuwegein
>
>Ronald Heller
>Technisch Consultant
>www.salience.nl
>ronald@xxxxxxxxxxx
>
>T +31(0)30 60 56 675
>F +31(0)30 60 56 324
>M +31(0)6 20 41 25 77
>MSN ronald_heller@xxxxxxxxxxx
>
>
>XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com


 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.