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

RE: Escaping the root node when using xsl:copy-of

Subject: RE: Escaping the root node when using xsl:copy-of
From: "Satish Terala" <saterala@xxxxxxxxxxx>
Date: Wed, 28 Jan 2004 13:24:31 +0530
terala
Works cool.Thanks a lot.
-Satish

-----Original Message-----
From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
[mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of
Jarno.Elovirta@xxxxxxxxx
Sent: Wednesday, January 28, 2004 12:59 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE:  Escaping the root node when using xsl:copy-of


Hi,

> Thanks for the answer but it does'nt quite answer my question.
> To make it clear This is my input xml.
> <WEATHER_FORECAST>
>     <CLOUD>   
>       <QUANTITY>
>         <AMOUNT>8</AMOUNT>
>       </QUANTITY>
>     </CLOUD>
>     
>     <TEMPERATURE>
>       <QUANTITY>
>         <AMOUNT>-1,7</AMOUNT>
>         <UNIT/>
>       </QUANTITY>
>     </TEMPERATURE>
>     <DURATION>
> 	</START_DATE_TIME>
> 	</END_DATE_TIME>

Your example XML is not well-formed…

>     </DURATION>
>   </WEATHER_FORECAST>
> Am trying to output some thing like this escaping the 
> DURATION element and the root element tag <WEATHER_FORECAST> element.
> <BODY>
>    <CLOUD>   
>       <QUANTITY>
>         <AMOUNT>8</AMOUNT>
>       </QUANTITY>
>     </CLOUD>
>     
>     <TEMPERATURE>
>       <QUANTITY>
>         <AMOUNT>-1,7</AMOUNT>
>         <UNIT/>
>       </QUANTITY>
>     </TEMPERATURE>
> <BODY>

To rephrase, you want an identity transformation where you replace WEATHER_FORECASE with BODY and ignore DURATION and it's descendants.

  <xsl:template match="WEATHER_FORECAST">
    <BODY>
      <xsl:apply-templates select="@* | node()"/>
    </BODY>
  </xsl:template>
  <xsl:template match="DURATION"/>
  <xsl:template match="@* | node()">
    <xsl:copy>
      <xsl:apply-templates select="@* | node()"/>
    </xsl:copy>
  </xsl:template>

Cheers,

Jarno -  Delerium: Truly (Club)… still, it's such a brilliant song

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

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