Subject: Re: [xsl] Accessing specific repetitive node From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx> Date: Fri, 05 Mar 2004 07:15:58 -0500 |
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
<xsl:for-each select="DATA/Table[@ID='2']/Data/Code[position() mod 2 = 1]"> <xsl:if test="position() > 1">, </xsl:if> <xsl:value-of select="."/> </xsl:for-each>
-- US XSL training: Washington,DC March 15; San Francisco,CA March 22 World-wide on-site corporate, government & user group XML training G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995) Male Breast Cancer Awareness http://www.CraneSoftwrights.com/s/bc
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Accessing specific repeti, Mark Williams | Thread | Re: [xsl] Accessing specific repeti, Mark Williams |
Re: [xsl] Accessing specific repeti, David Carlisle | Date | Re: [xsl] reccursive sum ?, David Carlisle |
Month |