[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Removing nodes but leaving the tree intact

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

RE:  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@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]


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.