This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Copy vs copy-of (was: How to delete empty element tag from output XML?)
- To: "Eliot, Topher" <Christopher_Eliot at jdedwards dot com>
- Subject: Re: Copy vs copy-of (was: How to delete empty element tag from output XML?)
- From: Jeni Tennison <mail at jenitennison dot com>
- Date: Sun, 5 Nov 2000 09:43:46 +0000
- CC: "'xsl-list at mulberrytech dot com'" <xsl-list at mulberrytech dot com>
- Organization: Jeni Tennison Consulting Ltd
- References: <14850.62369.773000.546127@menteith.com>
- Reply-To: xsl-list at mulberrytech dot com
Topher,
> How would your sample below be different from
> <xsl:template match="*" mode="copy-unless-empty">
> <xsl:if test="node()">
> <xsl:copy-of select="."/>
> </xsl:if>
> </xsl:template>
>> <xsl:template match="*" mode="copy-unless-empty">
>> <xsl:if test="node()">
>> <xsl:copy>
>> <xsl:copy-of select="@*"/>
>> <xsl:value-of select="."/>
>> </xsl:copy>
>> </xsl:if>
>> </xsl:template>
There might be a difference if the element that's being matched has
non-text children. For example:
<p>Copy me and forget my <em>emphasis</em>.</p>
would remain as it is under the first template, but under the second
it would become:
<p>Copy me and forget my emphasis.</p>
Cheers,
Jeni
---
Jeni Tennison
http://www.jenitennison.com/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list