position()

Subject: position()
From: Natalie Rooney <nrooney@xxxxxxxxxxxxx>
Date: Tue, 09 Nov 1999 10:41:14 -0600
Hi,

I have the following xml structure:

    <USERS>
          <USER>bunch of attributes</USER>
          <USER>bunch of attributes</USER>
          <USER>bunch of attributes</USER>
    </USERS>

I want to display the first user in a different way from the others.
So, here is what I tried to do:

<xsl:value-of select="//USERS/USER[1]/*[name()=$tagName]"/>

here $tagName is the attribute I want to display.  This works fine.
Then somewhere else, I try the following:

<xsl:for-each select="//USERS/USER[position() > 1]">

This returns nothing.  I am using the XSL:P processor to combine the xml
and xsl into html.  I have seen people mention problems using >, so I
also tried

<xsl:for-each select="//USERS/USER[not(position()=1)]">

Same result.  The weird thing is that when I use this:

<xsl:value-of select="count(//USERS/USER[position()=1])/>
or
<xsl:value-of select="count(//USERS/USER[position()=last()])/>

the returned value is 3.  but when I try position=2 or 3, the returned
value is 0.  Any hints??

Thanks,
Natalie


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


Current Thread
  • position()
    • Natalie Rooney - Tue, 09 Nov 1999 10:41:14 -0600 <=