[xsl]Problem with Position()?

Subject: [xsl]Problem with Position()?
From: Alice Ju-Hsuan Wei <ajwei@xxxxxxxxxxx>
Date: Sat, 13 Oct 2007 07:59:57 -0400
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