[Home] [By Thread] [By Date] [Recent Entries]

  • From: "Michael Kay" <mike@s...>
  • To: "'Job van Ommen'" <jobvanommen@g...>,<xml-dev@l...>
  • Date: Thu, 20 Nov 2008 12:11:05 -0000

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: 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.



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member