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

Re: How to Display multiple items

Subject: Re: How to Display multiple items
From: Phil Lanch <phil@xxxxxxxxxxxxxxx>
Date: Thu, 02 Dec 1999 12:23:29 +0000
display multiple select values
> <subject>
> <topic>Communication within the team - importance of team meetings</topic>
> <method>Micro-planning</method>
> <method>Creating a structure, defining processes and roles</method>
> <method>Briefing new members</method>
> <method>Sharing news</method>
> </subject>
> 
> As you can see, there are multiple <method> tags.
> I am using XSLT to display the contents.
> i Use follwing code in XSL:-
> 
> <xsl:template match="subject">
> <font class="display"><b><xsl:value-of select="topic" /></b></font><br />
> <font class="display"><xsl:value-of select="method" /></font><br />
> </xsl:template>
> 
> But only first <method> tags values are displayed.

Your select="method" _does_ select a list of all the <method> nodes;
however, when a node-list is converted to a string, only the fist node
is used.

> CAn anyone tell me, how to display values of all <method> tags.

You could try iterating over the <method> elements:

<xsl:template match="subject">
<font class="display"><b><xsl:value-of select="topic" /></b></font><br
/>
<xsl:for-each select="method">
  <font class="display"><xsl:value-of select="." /></font><br />
</xsl:for-each>
</xsl:template>

That's OK, but when your stylesheets get more complicated it's clearer
to split them up into separate templates:

<xsl:template match="subject">
  <xsl:apply-templates/>
</xsl:template>

<xsl:template match="topic">
  <font class="display"><b><xsl:apply-templates/></b></font><br />
</xsl:template>

<xsl:template match="method">
  <font class="display"><xsl:apply-templates/></font><br />
</xsl:template>

-- 

bah, humbug

phil

*witness relocation program alumnus*


 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.