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 |
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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Copy vs copy-of (was: How to delete, Eliot, Topher | Thread | RE: Can XSL process and separate on, sara . mitchell |
Re: Applying Templates, Jeni Tennison | Date | Re: Can XSL process and separate on, Benoit Cerrina |
Month |