[Home] [By Thread] [By Date] [Recent Entries]
Yves,
At 01:29 PM 3/21/2007, you wrote: David, David's was neater but mine was more fully commented. :-> And actually, they were the same solution, or based on the same approach in effect, with only cosmetic differences. While David's said "*", mine said "b|i|ul", but that too amounts to a cosmetic difference in this case. What's "a little inconvenient" in one case might be suitably clear or careful coding in another. But anyway -- David's *was* nice.... You wrote: Now you've got me even more confused. What I said was that my approach did *not* use a stylesheet to generate a stylesheet. Neither does David's. And as I said, they were the same solution, allowing for these two things to be the same: A.
<xsl:template match="x">
<xsl:choose>
<xsl:when test="$cond">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>B.
<xsl:template match="x">
<xsl:variable name="out">
<xsl:apply-templates/>
</xsl:variable>
<xsl:choose>
<xsl:when test="$cond">
<xsl:copy>
<xsl:copy-of select="$out"/>
</xsl:copy>
</xsl:when>
<xsl:otherwise>
<xsl:copy-of select="$out"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>... except that A (what David did) is a bit more concise, and B (what I did) is a bit more versatile (since you can do things like test what's inside $out when you do the test). Cheers, Wendell ====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================
|

Cart



