I've been asked to see if there is a way to match a given node based on the index of a named node? Here's an example:
<RecordSets> <RecordSet RecordSetId="Events"> <Columns> <Col Name="a" Type="Free" /> <Col Name="b" Type="Free" /> <Col Name="c" Type="Free" /> <Col Name="d" Type="Free" /> <Col Name="e" Type="Free" /> </Columns> <Rows>
<Row> <Col>1</Col> <Col>2</Col> <Col>3</Col> <Col>4</Col> <Col>5</Col> </Row>
<Row> <Col/> <Col/> <Col/> <Col/> <Col /> </Row>
</Rows> </RecordSet> </RecordSets>
So in this case I want to be able to select the index of say <Col Name="e" Type="Free" />
and use that index to match a template to <Col>5</Col>
I'm really struggling to achieve this. The best I've managed to come up with so far is:
<xsl:template match="Col[position() = last()" mode="RSLCell">
Which 'works' given my simplified example, but the position which needs to be selected won't always be the last one. Any ideas greatly appreciated. Thanks!
No comments:
Post a Comment