Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


RE: [xml-dev] Removing nodes but leaving the tree intact

From: "Michael Kay" <mike@--------.--->
To: "'Job van Ommen'" <jobvanommen@-----.--->, <xml-dev@-----.---.--->
Date: 11/20/2008 12:12:00 PM
The xsl-list at mulberrytech.com is the best place for getting XSLT coding
help.
 
This one is a standard "modified identity transform". Define one template
rule that copies nodes:
 
<xsl:template match="*">
  <xsl:copy>
    <xsl:apply-templates/>
  </xsl:copy>
</xsl:template>
 
and another that copies their children:
 
<xsl:template match="somecategory">
  <xsl:apply-templates/>
</xsl:template>
 
Michael Kay
http://www.saxonica.com/


  _____  

From: Job van Ommen [mailto:jobvanommen@g...] 
Sent: 20 November 2008 11:42
To: xml-dev@l...
Subject: [xml-dev] Removing nodes but leaving the tree intact



Hello Everyone,




I have a automatically generated xml tree like this:



<root>
  <someobject/>
  <someotherobject/>
  <somecategory>
    <somename>
      <somecategory>
        <someothername>
          <someobject/>
          <someotherobject/>
        </someothername>
      </somecategory>
    <someobject/>
    <someotherobject/>
  </some name>
  </some category>
</root>



I generate a lot of these files, always containing nested <somecategory>
elements.

Is there a clean way to use xsl to remove the <somecategory> elements and
return the xml intact, just without the <somecategory> elements?



Kind regards.





transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent