Re: [xsl] xmlns="" ??

Subject: Re: [xsl] xmlns="" ??
From: Brian Chrisman <brian.chrisman@xxxxxx>
Date: Tue, 01 Jun 2004 10:11:40 -0700
David Carlisle wrote:

 Side tracking a bit, is there any differences in the above two? If so, when
 do we use the former?


If you know the element name at the time the stylesheet is written than you can always do <foo> rather than xsl:element name="foo" the point of xsl:element is that you can generate element names on the fly eg

<xsl:element name="h{count(ancestor::*)}">

will generate an html h1 or h2 or... depending on how deep we are.

Another use is to generate xslt

<xsl:element name="xsl:value-of">

generates an xsl:value-of in teh result werease <xsl:value-of wiill be
executed as an instruction.

There are some other minor differences related to namespace handling but
they are rarely important.

David




Though it may sound pitiful, this is the only element I've encountered thus far where I think I'm forced to use the {} syntax in order to dynamically generate nodes (in most XSLt elements, I use the provided select="" attribute or content nodes). That said, I can't really think of a better way to specify it myself without making the name attribute optional and creating some sort of additional element-name select="" node.
My solution was to overcome my fear of {}... :-)



Current Thread