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

Selecting all siblings and self into a node-set

Subject: Selecting all siblings and self into a node-set
From: Randolph Kahle <randy.kahle@xxxxxxxxxxxxx>
Date: Sun, 28 Mar 2004 16:37:03 -0700
randolph kahle
I would like to build a node-set that I can use to
create a menu-bar in an HTML display.

I have an xml file that describes the layout of
the website with the following content:

<<<<<

<website>
   <webpage>
     <name>home</name>
	<file>../xml/home.xml</file>
   </webpage>
   <webpage>
     <name>clients</name>
     <file>../xml/clients.xml</file>
   </webpage>
   <webpage>
     <name>contact</name>
     <file>../xml/contact.xml</file>
   </webpage>
</website>

 >>>>>

I load this XML file into my XSL style sheet with:

<xsl:template match="/site">
   <xsl:variable name="menutree" select="document(structure/file)"/>
   <xsl:apply-templates select="$menutree" mode="meta2" />
</xsl:template>

with the variable "menutree" containing the parsed file.

Then I have a template matching "webpage":

<xsl:template match="webpage" mode="meta2">
   <xsl:variable name="menu-names">
     <xsl:value-of select="preceding-sibling::webpage[*]/name"/>
     <xsl:value-of select="name" />
     <xsl:value-of select="following-sibling::webpage[*]/name"/>
   </xsl:variable>

   <xsl:value-of select="$menu-names" />
   <xsl:apply-templates mode="meta2" />
</xsl:template>


I expect the output to be:

<<<<<

homeclientscontact

homeclientscontact

homeclientscontact

 >>>>>

but instead I get:

<<<<<

homeclients

homeclientscontact

homecontact

 >>>>>

which indicates that each "value-of" operator is only
picking up one node.

How can I get _all_ preceding and following
node's "name" elements into a single node-set?

Thank you!

Randy

[****** removed an attachment of type application/pkcs7-signature which had a name of smime.p7s]

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.