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

RE: XSL resources - Flat to hierarchy - Common ancesto

Subject: RE: XSL resources - Flat to hierarchy - Common ancestors
From: "Ben Simkins" <bsimkins@xxxxxxxxxx>
Date: Tue, 27 Jul 2004 13:48:09 +0200
ben simkins
Not wishing to quit on a winning streak...
> > 3. Given the hierarchical output from 2, I would like to extract all
> > nodes which are children of any of the ancestors of the node with a
> > given MenuId (including that node itself)
> > Expressed otherwise: the children, siblings, ancestors, uncles and
> > great-uncles, great-great-uncles (etc) of the given node.
> > Expressed otherwise: all Menus where MenuParentId IN (MenuIds of a
given
> > node and all of its ancestors)
>
> <xsl:template match="/Menus">
> 	<xsl:apply-templates select="Menu"/>
> </xsl:template>
>
> <xsl:template match="Menu">
> <xsl:variable name="MenuId" select="@MenuId"/>
> 	<xsl:apply-templates select="ancestor-or-self::Menu[@MenuId =
> $MenuId]"
> mode="MenuId">
> 		<xsl:with-param name="MenuId" select="$MenuId" />
> 	</xsl:apply-templates>
> </xsl:template>
>
> <xsl:template match="Menu" mode="MenuId">
> <xsl:param name="MenuId"/>
> ... output what you want here ...
> <xsl:apply-templates select="*[@MenuId = $MenuId]" mode="MenuId">
> 	<xsl:with-param name="MenuId" select="$MenuId"/>
> </xsl:apply-templates>
> </xsl:template>
>
> Untested, but this is the general idea...
What do the variable and the parameter do?

Wouldn't <xsl:with-param name="MenuId" select="@MenuId" /> also work in
the first "Menu" template ?

I take it this isn't the same as a parameter which would be passed in on
a query string (or whatever the xsl equivalent is)?
What I want to be able to do is to pass a MenuId to the xsl and have it
collapse everything except the branch on which that Menu is (in case
anyone wondered, the target use is for a frameless web site with 400+
menus, where I don't want to display all 400 menus on every click, and
where I don't want to loop through them on every click either)

Is that what this example does?

->If it isn't clear what I mean by 'collapse everything but', I'll send
an example

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.