Maybe I'm oversimplifying or not understanding the issue, but can't you
just do this:
<xsl:template match="WEATHER_FORECAST">
<xsl:element name="BODY">
<xsl:copy-of select="node()[not(self::DURATION)]"/>
</xsl:element>
</xsl:template>
-----Original Message-----
From: owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
[mailto:owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com] On Behalf Of
Satish
Terala
Sent: Wednesday, January 28, 2004 1:53 AM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: [xsl] Escaping the root node when using xsl:copy-of
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>
</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>
Using <xsl:copy-of select="node()[not(self::DURATION)]"/> escapes the
DURATION element , but i get the root <WEATHER_FORECAST> tag. My
question was how do i escape this.
<xsl:copy-of select="*[not(self::DURATION)]/node() |
node()[not(self::*)]"/> does'nt quite help, it knocks of all the
<TEMPERATURE> , <CLOUD> tags but not the root tag.
thanks
-Satish
-----Original Message-----
From: owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
[mailto:owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com]On Behalf Of
Jarno(_dot_)Elovirta(_at_)nokia(_dot_)com
Sent: Wednesday, January 28, 2004 12:01 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: [xsl] Escaping the root node when using xsl:copy-of
Hi,
Is there any way i can escape the root node (just the element
tag) being copied while all the children are copied as is.
<xsl:template match="/*">
<xsl:copy-of select="node()"/>
</xsl:template>
Currently am using <xsl:copy-of
select="node()[not(self::DURATION)]"/> which copies
everything except the DURATION child. Problem it also copies
the root node which is the node where i start copying.
I'm not sure if this is what you mean,
<xsl:copy-of select="*[not(self::DURATION)]/node() |
node()[not(self::*)]"/>
Cheers,
Jarno - Delerium: Truly (Club)
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list