|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Re: Node selection based on parent attribute
You can do it using recursive call-template. For that you will have to add a <xsl:call-template name="modeset"> <xsl:with-param name="nestedmode" select="*"/> </xsl:call-template> In your template match= "mode" then you can make a recursive template having name modeset and param name=nestedmode <xsl:template name="modeset"> <xsl:param name="nestedmode"/> <xsl:choose> <xsl:when test="node()[not(parent::mode)]"> <xsl:value-of select="*" /> </xsl:when> <!-- This is recursive --> <xsl:otherwise> <xsl:call-template name="modeset"> <xsl:with-param name="nestedmode" select="*"/> </xsl:call-template> <xsl:otherwise> </xsl:choose> </xsl:template> hope this help you enjoy ashu On Fri, 30 Aug 2002 katharine wykes wrote : >Thanks for that. >Would there be an easy way of making that recursive. So if there were sub/sub nodes under <menu id=6>, ie ><menu id=6> ><menu id=8> > <menu id=9/> > <menu id=10/>... and so on ></menu> ></menu> > >Cheers, > > >> From: "ashu t" <aashut@xxxxxxxxxxxxxx> >>Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx >>To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx >>Subject: Re: Node selection based on parent attribute >>Date: 30 Aug 2002 14:08:02 -0000 >> >> >>Hello Katharine Wykes >> >>You can do it in this way. >><xsl:template match="menu[@id='6']"> <!--here '' are used if this is a string --> >><xsl:value-of select="*"/> >></xsl:template> >>It will select all the child element of <menu id="what ever you want"> >>hope it will help you >>enjoy >>ashu >> >> >> >> >> >> >> >> >>On Fri, 30 Aug 2002 katharine wykes 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 t 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 >>> >> >> >>XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list > > > > >_________________________________________________________________ >Join the world?s largest e-mail service with MSN Hotmail. http://www.hotmail.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
|
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
|

Cart








