tags:

views:

18

answers:

1

Hi all,

This is my xml file

Input:

<world>

<patent>
  <xml>a</xml>
  <java>333</java>
  <jaxb>111</jaxb>
</patent>

</world>

I need the read the above xml file and reproduce the following the output

Output:

   <patent>
          <xml>a</xml>
          <java>333</java>
          <jaxb>111</jaxb>
     </patent>

I dont need the world element. How to achieve this using Xpath. Can anyone help me on this?

A: 

If we're doing this with XSLT 2.0, we can just use the <xsl:result-document> element.

It would look something like this:

<xsl:template match="patent">
   <xsl:result-document href="output.xml" format="xml">
      <xsl:copy>
         <xsl:apply-templates/>
      </xsl:copy>
   </xsl:result-document>
</xsl:template>

<xsl:template match="world">
   <xsl:apply-templates/>
<xsl:template>

<!-- identity template here -->
Jweede