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

[XSL]Display Different Results Based on Count of Node

Subject: [XSL]Display Different Results Based on Count of Node Sets
From: Alice Ju-Hsuan Wei <ajwei@xxxxxxxxxxx>
Date: Sun, 23 Sep 2007 10:54:59 -0400
 [XSL]Display Different Results Based on Count of Node
Hi,

Below are two templates I am using to display some titles of the book. I am wondering if anybody knows whether or not I can use the count function here so that for books with multiple books by one author, the titles would be broken off with the <p> tag, but those with only one, would not display the <p> tag. Anyone know if I should use <xsl:if> or the count function here?

Here is the XSLT:

   <xsl:template match="book">
       <p>
           <xsl:call-template name="author"/>
           <xsl:apply-templates/>
       </p>
   </xsl:template>

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

The XML:

   <book>
    <author>Tennison, Jeni</author>
   <title>Beginning XSLT</title>
   <title>Beginning XSLT 2.0</title>
   </book>

   <book>
   <author>Meyer, Eric</author>
   <title>The Zen of CSS</title>
   </book>

Thanks to those who may be able to help.

Alice

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.