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

RE: Expanding XML navigation

Subject: RE: Expanding XML navigation
From: "Alex" <alex.scott@xxxxxxxxxxxxxx>
Date: Mon, 27 Sep 2004 17:02:32 +0100
xml navigation
Yes!!!

I have tried it out with both the code which you posted, and the code which
David posted, so thank you both very much.

Alex.




-----Original Message-----
From: Andrew Welch [mailto:ajwelch@xxxxxxxxxxxxxxx]
Sent: 27 September 2004 16:43
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE:  Expanding XML navigation



This variation of the identity template should do what you need:

<xsl:param name="pageName" select="'manhattan'"/>

<xsl:template match="@*|node()">
    <xsl:copy>
      <xsl:copy-of select="@*"/>
      <xsl:if test="descendant-or-self::*[@name = $pageName]">
        <xsl:apply-templates select="node()"/>
      </xsl:if>
    </xsl:copy>
</xsl:template>

It basically will output the current node, then only continue processing
it's children if a descendent of the current node has an attribute with
the required attribute.  It's not that efficient as it walks the
descendant axis for every node, but if your tree isn't that deep it
shouldn't be too bad.

cheers
andrew

> I am still stuck with this one.
> I just want an expanding list.
>
> Using the Identity transform I get that I can list my whole
> tree, and remove nodes from it: This is the entire tree:
>
> <linkmap>
> <page name="index">
>     <page name="about">
>       <page name="history"/>
>     </page>
>     <page name="events"/>
>     <page name="contact">
>       <page name="directions">
>         <page name="new-york">
>           <page name="manhattan">
>             <page name="uptown"/>
>           </page>
>           <page name="bronx"/>
>         </page>
>         <page name="paris">
>           <page name="left-bank"/>
>           <page name="right-bank"/>
>         </page>
>       </page>
>      </page>
> </page>
> </linkmap>
>
> If am currently on the Manhattan page,
> Then I just want to show:
> 1)the root nodes about-events-contacts
> 2)As I know that current node is Manhattan I want to find its
> root node which is contact. 3)I then want to show the
> children of contact. 4)I then want to show all the
> descendants of the child of contact which is also the
> ancestor of manhattan down to the children of manhattan.
>
> The result tree should look something like this below:
>
>
>
> <linkmap>
> <page name="index">
>     <page name="about"/>
>     <page name="events"/>
>     <page name="contact">
>       <page name="directions">
>         <page name="new-york">
>           <page name="manhattan">
>             <page name="uptown"/>
>           </page>
>           <page name="bronx"/>
>         </page>
>         <page name="paris">
>         </page>
>       </page>
>      </page>
> </page>
> </linkmap>
>
>
> Would it be easier for me to use a process of elimination as
> andrew has suggested or a process of construction?

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.