aspose file tools*
The moose likes XML and Related Technologies and the fly likes attributes.... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "attributes...." Watch "attributes...." New topic
Author

attributes....

dell computer
Greenhorn

Joined: Oct 19, 2000
Posts: 3
Hello,
I want to display the attributes written for H_DESC_KEY,TYPE,STATE,BASIS in xml in a table....
How to write the code for that in xsl...I am a bit confused in this aspect...
I am providing my xml and xsl code here:hello.xml:
<?xml version = '1.0'?>
<?xml-stylesheet href="hello.xsl" type="text/xsl"?>
<top>
<data NUM="1">
<HIERARCHY_ID>1</HIERARCHY_ID>
<H_DESC_KEY localized="Manufacturing Product Hierarchy"
>Production001</H_DESC_KEY>
<TYPE localized="Product">Product</TYPE>
<BASIS localized="Product Style">ProdStyle</BASIS>
<STATE localized="Locked">Locked</STATE>
<HLEVEL_ID NULL="YES" />
</data>
<data NUM="2">
<HIERARCHY_ID>2</HIERARCHY_ID>
<H_DESC_KEY localized="Pricing Product Hierarchy">PricingPro001</H_DESC_KEY>
<TYPE localized="Product">Product</TYPE>
<BASIS localized="[HLevel 102 localized description]">HLevel</BASIS>
<STATE localized="Pending">Pending</STATE>
<HLEVEL_ID>102</HLEVEL_ID>
</data>
<data NUM="3">
<HIERARCHY_ID>3</HIERARCHY_ID>
<H_DESC_KEY localized="Pricing Customer Hierarchy">PricingCus001</H_DESC_KEY>
<TYPE localized="Customer">Customer</TYPE>
<BASIS localized="Customer">Customer</BASIS>
<STATE localized="Pending">Pending</STATE>
<HLEVEL_ID NULL="YES"/>
</data>
<data NUM="4">
<HIERARCHY_ID>4</HIERARCHY_ID>
<H_DESC_KEY localised="Sales Performance Hierarchy">Salesperfo001</H_DESC_KEY>
<TYPE localized="Product">Product</TYPE>
<BASIS localized="[HLevel 102 localized description]">HLevel</BASIS>
<STATE localized="Locked">Locked</STATE>
<HLEVEL_ID>104</HLEVEL_ID>
</data>
</top>
hello.xsl:
<?xml version="1.0" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<xsl:template match="/">
<HTML>
<BODY>
<TABLE BORDER="2" CELLSPACING="8" CELLPADDING="5" WIDTH="80%" HEIGHT="50%" BGCOLOR="#00FFFF" BORDERCOLOR="#000000">
<CAPTION ALIGN="Top">Hierarchy</CAPTION>
<!-- Create table titles -->
<TR>
<TD>HIERARCHY_ID</TD>
<TD>H_DESC_KEY</TD>
<TD>TYPE</TD>
<TD>BASIS</TD>
<TD>STATE</TD>
<TD>HLEVEL_ID</TD>
</TR>
<!-- Do a for-each loop -->
<xsl:for-each select="top/data">
<!-- Create a new table row -->
<TR>
<!-- Create and populate table cells -->
<TD><xsl:value-of select="HIERARCHY_ID"/></TD>
<TD><xsl:value-of select="H_DESC_KEY"/></TD>
<TD><xsl:value-of select="TYPE"/></TD>
<TD><xsl:value-of select="BASIS"/></TD>
<TD><xsl:value-of select="STATE"/></TD>
<TD><xsl:value-of select="HLEVEL_ID"/></TD>
</TR>
</xsl:for-each>
</TABLE>
</BODY>
</HTML>
</xsl:template>
</xsl:stylesheet>

....can anybody help me....Thanks in advance,,,
prabhu palanisamy
Greenhorn

Joined: Oct 30, 2000
Posts: 27
hi dell
this code will work
<?xml version="1.0" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<xsl:template match="/">
<HTML>
<BODY>
<TABLE BORDER="2" CELLSPACING="8" CELLPADDING="5" WIDTH="80%" HEIGHT="50%" BGCOLOR="#00FFFF" BORDERCOLOR="#000000">
<CAPTION ALIGN="Top">Hierarchy</CAPTION>
<!-- Create table titles -->
<TR>
<TD>HIERARCHY_ID</TD>
<TD>H_DESC_KEY</TD>
<TD>TYPE</TD>
<TD>BASIS</TD>
<TD>STATE</TD>
<TD>HLEVEL_ID</TD>
</TR>
<!-- Do a for-each loop -->
<xsl:for-each select="top/data">
<!-- Create a new table row -->
<TR>
<!-- Create and populate table cells -->
<TD><xsl:value-of select="HIERARCHY_ID"/></TD>
<TD><xsl:value-of select="H_DESC_KEY/@localized"/></TD>
<TD><xsl:value-of select="TYPE/@localized"/></TD>
<TD><xsl:value-of select="BASIS/@localized"/></TD>
<TD><xsl:value-of select="STATE/@localized"/></TD>
<TD><xsl:value-of select="HLEVEL_ID"/></TD>
</TR>
</xsl:for-each>
</TABLE>
</BODY>
</HTML>
</xsl:template>
</xsl:stylesheet>
bye
Dd R
Greenhorn

Joined: Jul 23, 2000
Posts: 2
I appreciate your help. Thankyou very much....The code works
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: attributes....