Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • 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

Unnecessary Tags

 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I have some problem with XSLT - the following is the XSL Stylesheet Source File
<pre>
<?xml version="1.0"?>
<!--
Sample Transformation from EDIFACT ORDERS -> SAP IDOC ORDERS
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:counter="de.mendelson.eagle.transform.util.Counter"
xmlns:mapping="de.mendelson.eagle.transform.util.MappingTable"
xmlns:system="de.mendelson.eagle.transform.util.SystemAccess" version="1.0">
<!-- this is the initialisation of parameter, which can be added from outside -->
<xsl :param name="MANDT" select="'000'"/>
<xsl :param name="SNDPRN" select="'000'"/>
<!-- the mainloop -->
<!-- copy everything that has no other pattern defined -->
<xsl:template match="/">
<test>
</test>
<xsl:apply-templates/>
</xsl:template>
<!-- copy everything that has no other pattern defined -->
<xsl:template match="* | @*">
<!-- this set the directory of the mapping tables -->
<xsl:value-of select="mapping:setDir('/home/hp/javadev/src/com/inubit/ibis/test/')"/>
<xsl:copy><xsl:copy-of select="@*"/><xsl:apply-templates/></xsl:copy>
</xsl:template>
<xsl:template match="/BMECAT/T_NEW_CATALOG/CATALOG_GROUP_SYSTEM/ARTICLE_TO_CATALOGGROUP_MAP">
<xsl:copy>
<xsl:call-template name="myBMEcat"/>
<!-- go on with the the child nodes -->
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
<!-- do nothing because CATALOG_GROUP_ID was already created by template myBMEcat -->
<xsl:template match="/BMECAT/T_NEW_CATALOG/CATALOG_GROUP_SYSTEM/ARTICLE_TO_CATALOGGROUP_MAP/CATALOG_GROUP_ID">
</xsl:template>

<xsl:template name="myBMEcat">

<CATALOG_GROUP_ID>
<xsl:value-of select="mapping:getValue('test.map',string(CATALOG_GROUP_ID))"/>
</CATALOG_GROUP_ID>

</xsl:template>
</xsl:stylesheet>
</pre>
the output after XSLT is

<CATALOG_GROUP_ID xmlns:system="de.mendelson.eagle.transform.util.SystemAccess" xmlns:mapping="de.mendelson.eagle.transform.util.MappingTable" xmlns:counter="de.mendelson.eagle.transform.util.Counter">0</CATA

I wonder why the Header Information is in the tag<CATALOG_GROUP_ID>
</CATALOG_GROUP_ID>
can anybody explain me why this header Information are coded in
this tag, how can i avoid this ?
Thank you
[This message has been edited by Holger Prause (edited December 13, 2000).]
 
Holger Prause
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Got the Solution :
<pre>
<?xml version="1.0"?>
<!--
Sample Transformation from EDIFACT ORDERS -> SAP IDOC ORDERS
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:counter="de.mendelson.eagle.transform.util.Counter"
xmlns:mapping="de.mendelson.eagle.transform.util.MappingTable"
xmlns:system="de.mendelson.eagle.transform.util.SystemAccess" version="1.0">
<!-- this is the initialisation of parameter, which can be added from outside -->
<xsl :param name="MANDT" select="'000'"/>
<xsl :param name="SNDPRN" select="'000'"/>
<!-- the mainloop -->
<!-- copy everything that has no other pattern defined -->
<xsl:template match="/">
<BMECAT>
<xsl:apply-templates/>
</BMECAT>
</xsl:template>
<!-- copy everything that has no other pattern defined -->
<xsl:template match="* | @*">
<!-- this set the directory of the mapping tables -->
<xsl:value-of select="mapping:setDir('/home/hp/javadev/src/com/inubit/ibis/test/')"/>
<xsl:copy><xsl:copy-of select="@*"/><xsl:apply-templates/></xsl:copy>
</xsl:template>
<xsl:template match="/BMECAT">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="/BMECAT/T_NEW_CATALOG/CATALOG_GROUP_SYSTEM/ARTICLE_TO_CATALOGGROUP_MAP">
<xsl:copy>
<xsl:call-template name="myBMEcat"/>
<!-- go on with the the child nodes -->
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
<!-- do nothing because CATALOG_GROUP_ID was already created by template myBMEcat -->
<xsl:template match="/BMECAT/T_NEW_CATALOG/CATALOG_GROUP_SYSTEM/ARTICLE_TO_CATALOGGROUP_MAP/CATALOG_GROUP_ID">
</xsl:template>

<xsl:template name="myBMEcat">

<CATALOG_GROUP_ID>
<xsl:value-of select="mapping:getValue('test.map',string(CATALOG_GROUP_ID))"/>
</CATALOG_GROUP_ID>


</xsl:template>
</pre>
But thanks
</xsl:stylesheet>
[This message has been edited by Holger Prause (edited December 13, 2000).]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!