I have a question on how to access the nodes from the XML using XSL.
I have a xml like this:
<Table>
<Row>
<Cell Type="Main" Id="980">Test22</Cell>
<Cell Type="SubElement">Test22 Sub Element1</Cell>
</Row>
<Row>
<Cell Type="Main" Id="123">Test</Cell>
<Cell/>
</Row>
<Row>
<Cell Type="SubElement">Test Sub Element1</Cell>
<Cell Type="Element">xyz</Cell>
</Row>
<Row>
<Cell Type="SubElement">Test Sub Element2</Cell>
<Cell Type="Element">abc</Cell>
</Row>
<Row>
<Cell Type="Main" Id="456">Test1</Cell>
<Cell/>
</Row>
<Row>
<Cell Type="SubElement">Test1 Sub Element1</Cell>
<Cell Type="Element">awe</Cell>
</Row>
<Row>
<Cell Type="SubElement">Test1 Sub Element2</Cell>
<Cell Type="Element">scd</Cell>
</Row>
</Table>
Now, I need to get the 1st Row’s Id (i.e. Cell[Type=’Main’]/@Id) from the 2nd & 3rd Row’s Element Cell (1st row is the parent row for 2nd & 3rd row).
Similarly I need to access 4th Row’s Id (i.e. Cell[Type=’Main’]/@Id) from the 5th & 6th Row
(4th row is the parent row for 5th & 6th row).
I tried using xsl:variables but I couldn’t assign values dynamically.
Please advise. Thanks in advance
Use the following expression within a template that is processing a
SubElementorElement:For example:
Outputs (spaces removed):