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

Re: Node Concatenation

Subject: Re: Node Concatenation
From: "J.Pietschmann" <j3322ptm@xxxxxxxx>
Date: Mon, 04 Nov 2002 21:45:31 +0100
batteries accesories
Juan Carlos Gonzalez wrote:
Hi:

I'm trying to accomplish the following in a dropdown
list box:

Accesories - Batteries
Accesories - Cables
Accesories - FireWire Products
Accesories - FireWire Products - Hubs
Accesories - FireWire Products - Interface
Accesories - Headsets
Digital
Digital - Cameras
...etc...

This is my xml file:

<root>
<cat id=1 name="Accesories">
  <cat id=2 name="Batteries"/>
  <cat id=2 name="Cables"/>
  <cat id=3 name="FireWire Products">
    <cat id=4 name="Hubs"/>
    <cat id=5 name="Interface"/>
  </cat>
  <cat id=6 name="Headsets"/>
</cat>
<cat id=7 name="Digital">
  <cat id=8 name="Cameras"/>
</cat>
</root>

Walk the ancestor axis: <xsl:template match="cat"> <xsl:for-each select="(ancestor::cat)"> <xsl:sort select="."/> <!-- may be unnecessary --> <xsl:value-of select="@name"> <xsl:if test="position()!=last()"> <xsl:text> - </xsl:text> </xsl:if> </xsl:for-each> <xsl:apply-templates/> </xsl:template> (Untested, watchout for unwanted whitespace, LF etc.)

J.Pietschmann


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.