[xsl] accessing node by position

Subject: [xsl] accessing node by position
From: "Vincent Finn" <vincent.finn@xxxxxxxxxxxxx>
Date: Wed, 19 May 2004 11:05:40 +0100
Hi,

I need to access an xml value by it's position.
can this be done (or is there a better way to do it)

I have the xml below for generating a table.
I process <columns> to build the table header, then <rows> to build
the body.

When I am in a cell I need to find the type of the data for formatting
I don't know how to access the correct type node

I was thinking of something like
<xsl:value-of select="../../../columns/column(position())/type"/>
but after reading the faq that sort of 'on-the-fly' XPath generation
isn't allowed

Is there a nice way doing this?

Any help appreciated!

	Vin

<table>
	<columns>
		<column>
			<type>datetime</type>
			<value>time</value>
		</column>
		<column>
			<type>float</type>
			<value>Item1</value>
		</column>
		<column>
			<type>int</type>
			<value>Item2</value>
		</column>
		<column>
			<type/>
			<value>Item3</value>
		</column>
	</columns>
		
	<rows>
		<row>
			<cell>
				<value>2004-05-05T12:53:34.873</value>
			</cell>
			<cell>
				<value>1567.98765</value>
			</cell>
			<cell>
				<value>136</value>
			</cell>
			<cell>
				<value>hello</value>
			</cell>
		</row>
	</rows>
</table>

Current Thread