Hello,
I'm trying to loop through values in an above node to get the "columnname" and can't seem to get the syntax correct. Any help is appreciated!
XML:
<Data>
<Check>
<DetailedData>
<ColumnNames>
<ColumnName>UserName</ColumnName>
<ColumnName>Status</ColumnName>
</ColumnNames>
<DataRows>
<DataRow>
<DataValue>USER</DataValue>
<DataValue>ENABLED</DataValue>
</DataRow>
<DataRow>
<DataValue>USER2</DataValue>
<DataValue>DISABLED</DataValue>
</DataRow>
</DetailedData>
</Check>
<Check>
<DetailedData>
<ColumnNames>
<ColumnName>Type</ColumnName>
<ColumnName>Location</ColumnName>
<ColumnName>Status</ColumnName>
</ColumnNames>
<DataRows>
<DataRow>
<DataValue>1</DataValue>
<DataValue>US</DataValue>
<DataValue>Disabled</DataValue>
</DataRow>
<DataRow>
<DataValue>6</DataValue>
<DataValue>US</DataValue>
<DataValue>enabled</DataValue>
</DataRow>
</DetailedData>
</Check>
</Data>
XSL:
<xsl:template match="/">
<html>
<body>
<table><caption>Table1</caption>
<tr>
<td>FieldValue</td>
<td>FieldName</td>
</tr>
<xsl:for-each select="Data/Check/DetailedData/DataRows/DataRow/DataValue">
<tr>
<td><xsl:value-of select="."/></td>
<td> ***need value of column name here*** </td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
Final Desired Output:
FieldValue FieldName
UserName User
Status Enabled
UserName User2
Status Disabled
Type 1
Location US
Status Disabled
Type 6
Location US
Status enabled
I'm trying to loop through values in an above node to get the "columnname" and can't seem to get the syntax correct. Any help is appreciated!
XML:
<Data>
<Check>
<DetailedData>
<ColumnNames>
<ColumnName>UserName</ColumnName>
<ColumnName>Status</ColumnName>
</ColumnNames>
<DataRows>
<DataRow>
<DataValue>USER</DataValue>
<DataValue>ENABLED</DataValue>
</DataRow>
<DataRow>
<DataValue>USER2</DataValue>
<DataValue>DISABLED</DataValue>
</DataRow>
</DetailedData>
</Check>
<Check>
<DetailedData>
<ColumnNames>
<ColumnName>Type</ColumnName>
<ColumnName>Location</ColumnName>
<ColumnName>Status</ColumnName>
</ColumnNames>
<DataRows>
<DataRow>
<DataValue>1</DataValue>
<DataValue>US</DataValue>
<DataValue>Disabled</DataValue>
</DataRow>
<DataRow>
<DataValue>6</DataValue>
<DataValue>US</DataValue>
<DataValue>enabled</DataValue>
</DataRow>
</DetailedData>
</Check>
</Data>
XSL:
<xsl:template match="/">
<html>
<body>
<table><caption>Table1</caption>
<tr>
<td>FieldValue</td>
<td>FieldName</td>
</tr>
<xsl:for-each select="Data/Check/DetailedData/DataRows/DataRow/DataValue">
<tr>
<td><xsl:value-of select="."/></td>
<td> ***need value of column name here*** </td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
Final Desired Output:
FieldValue FieldName
UserName User
Status Enabled
UserName User2
Status Disabled
Type 1
Location US
Status Disabled
Type 6
Location US
Status enabled