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

Re: Copy vs copy-of (was: How to delete empty element tag fr

Subject: Re: Copy vs copy-of (was: How to delete empty element tag from output XML?)
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Sun, 5 Nov 2000 09:43:46 +0000
copy unless empty
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


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.