[xsl] postion gives me 2 instead of 1

Subject: [xsl] postion gives me 2 instead of 1
From: Paul Tremblay <phthenry@xxxxxxxxxxxxx>
Date: Fri, 20 Jun 2003 01:24:56 -0400
I am having problems trying to do something with just the first element.

Here is a fragment from my XML document:


    

    <orderedlist>
        <listitem number="1">
            <para>
Install python (www.python.org).
            </para>
	    
        </listitem>
	<listitem number="2">
            <para>
Download the xml2txt from (?).
            </para>
	    <para>
You can find the latest working versions from ...
	    </para>
        </listitem>
	</orderedlist>

I want to put a number just in front of the first paragraphs in each
listitem.  

Here is a try from my xslt stylesheet:


    <xsl:template match = "listitem/para[1]">
        <block>
            <xsl:value-of select = "../@number"/>
            <xsl:apply-templates/>
        </block>
    </xsl:template>

This doesn't work. For some reason, xslt gives the position number as 2
for the first paragraph. For example, this styelsheet works, but I don't know
why:

<xsl:template match = "listitem/para">
       <xsl:if test = "position() = 2">
        <block>
            <xsl:value-of select = "../@number"/>
            <xsl:apply-templates/>
        </block>
       </xsl:if>
</xsl:template>

Thanks

Paul


-- 

************************
*Paul Tremblay         *
*phthenry@xxxxxxxxxxxxx*
************************

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread