• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Jeanne Boyarsky
  • Tim Cooke
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
Bartenders:

XSLT problem.

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,
I have a XSLT code which works fine and it is as follows :
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl utput method="xml" indent="yes"/>

<xsl:template match="/">
<PERIODIC_TABLE><xsl:apply-templates/></PERIODIC_TABLE>
</xsl:template>
<xsl:template match="PERIODIC_TABLE/node()">
<xsl:copy-of select="."/>
</xsl:template>
<xsl:template match="PERIODIC_TABLE/ATOM[NAME='Swarup']">
<xsl:element name="ATOM">
<xsl:copy-of select="@*"/>
<xsl:copy-of select="node()"/>

<xsl:element name="NAME">
<xsl:attribute name="b">x</xsl:attribute>Swap</xsl:element>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
Now on the same lines if i use this code IT DOES NOT WORK as the DEPTH (i.e company/companyDetails/classificationInfo) increases it gives problem....
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl utput method="xml" indent="yes"/>

<xsl:template match="/">
<company><xsl:apply-templates/></company>
</xsl:template>
<xsl:template match="company/node()">
<xsl:copy-of select="."/>
</xsl:template>
<xsl:template match="company/companyDetails/classificationInfo[naics='333412']">
<xsl:element name="classificationInfo">
<xsl:copy-of select="@*"/>
<xsl:copy-of select="node()"/>

<xsl:element name="naics">
<xsl:attribute name="naics">007</xsl:attribute>77777</xsl:element>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
Thanks in Advance...
 
He's dead Jim. Grab his tricorder. I'll get his wallet and this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic