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

Problem with Position()?

Subject: Problem with Position()?
From: Alice Ju-Hsuan Wei <ajwei@xxxxxxxxxxx>
Date: Sat, 13 Oct 2007 07:59:57 -0400
Problem with Position()?
Hi,

I am trying to compile a document where I can display things differently based on the position of the <p> tags. However, now it does not print back anything that is in the <p> in the XSLT below? Can someone please tell me what is wrong with this?

XSLT:

<xsl:template match="book">

<div>
   <xsl:apply-templates select="./@author"/>,
   <i><xsl:apply-templates select="./@title"/></i>.
    (<xsl:apply-templates select="./@topic"/>)
    [  <xsl:apply-templates/>]
            </div>
   </xsl:template>

<xsl:template match="p">
       <xsl:choose>
           <xsl:when test="position()!=1">
               <p>
                   <xsl:call-template name="rend"/>
                   <xsl:apply-templates/>
               </p>
           </xsl:when>
           <xsl:otherwise>
               <xsl:if test="position()=1">
                   <xsl:apply-templates/>
               </xsl:if>
           </xsl:otherwise>
       </xsl:choose>
   </xsl:template>

XML:

<book topic="Technology" author="Tennison, Jeni" title="Beginning XSLT">

<p>New York: Apress, 2002.</p>
<p>The book serves as an introduction to XSLT based on the examples of a television program set. A resourceful book for those new to the technology.</p>
</book>


Intended Output:

Tennison, Jeni, Beginning XSLT. (Technology). New York: Apress. 2002
The book serves as an introduction to XSLT based on the examples of a television program set. A resourceful book for those new to the technology.


Thanks to those who can 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.