This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Copy vs copy-of (was: How to delete empty element tag from output XML?)


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]