[xsl] Accessing specific repetitive node

Subject: [xsl] Accessing specific repetitive node
From: "Mark Williams" <mark@xxxxxxxxxxx>
Date: Fri, 5 Mar 2004 11:47:12 -0000
Hi,

I sort help on this previously and got a number of answers.

The original question was, how do I access repeating nodes in an xml file
outside of a for-each
statement?  I can get it to work but only for the first item in the
repetitive block.

The XML looks like this

<DATA>
    <Table ID="2">
        <Data>
            <Code>1</Code>
            <Code>2</Code>
            <Code>3</Code>
            <Code>4</Code>
            <Code>5</Code>
           </Data>
    </Table>
</DATA>

I need to access the first 1, 3 and 5 items.  I have tried it in the
following ways:

 <xsl:value-of select="DATA/Table[@ID='2']/Data/Code[1]" />  //this works
okay
 <xsl:value-of select="DATA/Table[@ID='2']/Data/Code[position()=1]" />
//this also works okay

But as soon as I try and access any item other than the first I get nothing
in return.

Has anyone got any ideas why?

TIA

Mark


 XSL-List info and archive


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


Current Thread