rvijayendran
Programmer
Hi.. I have a XML :
<CategoryDataSet>
<Group>
<dim_tag>MKT</dim_tag>
<group_name>M.4135930</group_name>
<group_sequence>1</group_sequence>
</Group>
<Group>
<dim_tag>MKT</dim_tag>
<group_name>M.4066346</group_name>
<group_sequence>2</group_sequence>
</Group>
<Item>
<dim_tag>MKT</dim_tag>
<item_tag>M.4135930</item_tag>
<item_short_desc>KWIK TRIP</item_short_desc>
</Item>
<Item>
<dim_tag>MKT</dim_tag>
<item_tag>M.4066346</item_tag>
<item_short_desc>FOOD LION</item_short_desc>
</Item>
</CategoryDataSet>
I want this transformed to the below format :
dim_tag group_name group_sequence item_short_desc
MKT M.4135930 1 KWIK TRIP
MKT M.4066346 2 FOOD LION
Please suggest a way. I had tried with this XSL, but my problem is i m not able to match the CategoryDataSet/Group/group_name with the CategoryDataSet/Item/item_tag values.
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl=" <xsl:template match="/">
<html>
<body>
<h2>Group Data Set</h2>
<table border="1">
<tr bgcolor="#9acd32">
<th align="left">dim_tag</th>
<th align="left">group_name</th>
<th align="left">group_sequence</th>
<th align="left">item_short_desc</th>
</tr>
<xsl:for-each select="CategoryDataSet/Group">
<tr>
<td>
<xsl:value-of select="dim_tag"/>
</td>
<td>
<xsl:value-of select="group_name"/>
</td>
<td>
<xsl:value-of select="group_sequence"/>
</td>
<td>
<xsl:if test="group_name = CategoryDataSet/Item/item_tag"> <xsl:value-of select="CategoryDataSet/Item/item_short_desc"/>
</xsl:if> </td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
<CategoryDataSet>
<Group>
<dim_tag>MKT</dim_tag>
<group_name>M.4135930</group_name>
<group_sequence>1</group_sequence>
</Group>
<Group>
<dim_tag>MKT</dim_tag>
<group_name>M.4066346</group_name>
<group_sequence>2</group_sequence>
</Group>
<Item>
<dim_tag>MKT</dim_tag>
<item_tag>M.4135930</item_tag>
<item_short_desc>KWIK TRIP</item_short_desc>
</Item>
<Item>
<dim_tag>MKT</dim_tag>
<item_tag>M.4066346</item_tag>
<item_short_desc>FOOD LION</item_short_desc>
</Item>
</CategoryDataSet>
I want this transformed to the below format :
dim_tag group_name group_sequence item_short_desc
MKT M.4135930 1 KWIK TRIP
MKT M.4066346 2 FOOD LION
Please suggest a way. I had tried with this XSL, but my problem is i m not able to match the CategoryDataSet/Group/group_name with the CategoryDataSet/Item/item_tag values.
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl=" <xsl:template match="/">
<html>
<body>
<h2>Group Data Set</h2>
<table border="1">
<tr bgcolor="#9acd32">
<th align="left">dim_tag</th>
<th align="left">group_name</th>
<th align="left">group_sequence</th>
<th align="left">item_short_desc</th>
</tr>
<xsl:for-each select="CategoryDataSet/Group">
<tr>
<td>
<xsl:value-of select="dim_tag"/>
</td>
<td>
<xsl:value-of select="group_name"/>
</td>
<td>
<xsl:value-of select="group_sequence"/>
</td>
<td>
<xsl:if test="group_name = CategoryDataSet/Item/item_tag"> <xsl:value-of select="CategoryDataSet/Item/item_short_desc"/>
</xsl:if> </td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>