XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
RE: [xml-dev] Removing nodes but leaving the tree intact

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@gmail.com]
Sent: 20 November 2008 11:42
To: xml-dev@lists.xml.org
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.



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


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS