[Home] [By Thread] [By Date] [Recent Entries]
This all seems a matter of preference. Which is fine. But preferences are different from rules obviously. Setting aside personal preference, I use the same general rule that Wendell alluded to earlier (I think in this same thread, but I read it a day or two ago, so I'm not certain) When you need to make a decision at run time as to what the output element name and namespace (or simply name() for the namespace:element-name, or local-name() for just the element-name if you plan to copy the current element name into the output stream) will be, use xsl:element. For example (a VERY simply example -- not much use-case focus place on this obviously) <xsl:template match="*"> <xsl:variable name="$output-name">
<xsl:choose>
<xsl:when test="name() = 'foo'">bar</xsl:when>
<xsl:otherwise><xsl:value-of select="name()"/></xsl:otherwise>
</xsl:choose>
</xsl:template> For a slightly more advanced way of using dyanmic element naming see: ([1],[2]), otherwise, the above should provide enough to at least think about how to implement a dynamic naming system and when it seems like a good idea to use one or the other in regards to Wendell's original question. Performance and personal preference are the only other two reasons I can think of to use one over the other. Performance is processor dependent, but using a simple "calling an instruction via an instruction element is going to invoke a process beyond simple output serialization". Personal preference is (GoTo: start of this sentence.) ;) [1] : http://www.oreillynet.com/xml/blog/2005/08/part_2_assets_atom_feeds_and_a.htm l [2] : http://www.oreillynet.com/xml/blog/2005/09/part_3_assets_atom_feeds_and_a.htm l On Sat, 27 May 2006 11:29:24 -0600, Martin Holmes <mholmes@xxxxxxx> wrote: Hi there,
|

Cart



