xsl : getting specific node values from a table
Posted
by prashant rao
on Stack Overflow
See other posts from Stack Overflow
or by prashant rao
Published on 2009-09-15T12:35:11Z
Indexed on
2010/03/23
6:03 UTC
Read the original article
Hit count: 318
xslt
My XML Code
<DBE:Attribute name="Test1" type="Table">
<DBE:Table>
<DBE:TableHeader>
<DBE:TableColumn>t1</DBE:TableColumn>
<DBE:TableColumn>t2</DBE:TableColumn>
<DBE:TableColumn>t3</DBE:TableColumn>
<DBE:TableColumn>t4</DBE:TableColumn>
<DBE:TableColumn>t5</DBE:TableColumn>
<DBE:TableColumn>t6</DBE:TableColumn>
<DBE:TableColumn>t7</DBE:TableColumn>
<DBE:TableColumn>t8</DBE:TableColumn>
<DBE:TableColumn>t9</DBE:TableColumn>
<DBE:TableColumn>t10</DBE:TableColumn>
<DBE:TableColumn>t11</DBE:TableColumn>
<DBE:TableColumn>t12</DBE:TableColumn>
<DBE:TableColumn>t13</DBE:TableColumn>
</DBE:TableHeader>
<DBE:TableRow>
<DBE:TableData>0300 </DBE:TableData>
<DBE:TableData/>
<DBE:TableData>25</DBE:TableData>
<DBE:TableData>25</DBE:TableData>
<DBE:TableData>2009/09/03</DBE:TableData>
<DBE:TableData/>
<DBE:TableData>BAG</DBE:TableData>
<DBE:TableData>rrr</DBE:TableData>
<DBE:TableData>Yes</DBE:TableData>
<DBE:TableData>12</DBE:TableData>
<DBE:TableData>2009/03/09</DBE:TableData>
<DBE:TableData>GO</DBE:TableData>
<DBE:TableData/>
</DBE:TableRow>
</DBE:Table>
</DBE:Attribute>
I would like my output to be ->
t7 t5 t1 t13 --> Header
---------------------------------------------------------------
BAG 2009/09/03 0300 GO --> ROW1
.............................................................. --> ROW2
and so on
My XSL code --> (for only selected values to be displayed)
<xsl:for-each select="DBE:Attribute[@name='Test1']/DBE:Table/DBE:TableRow">
<tr bgcolor="white">
<xsl:for-each select="DBE:TableData">
<td>
<xsl:value-of select="node()|*">
</xsl:value-of>
</td>
</xsl:for-each>
</tr>
</xsl:for-each>
© Stack Overflow or respective owner