• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

attributes....

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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,,,
 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I appreciate your help. Thankyou very much....The code works
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!