This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: _why_ do people use xsl:element and xsl:attribute so much Was Re: xslt svg problem
> I found them easier to understand when I was starting to climb the
> learning curve.
It seems like you are not alone, which is really why I asked the
question, because I don't understand why that is so. Which sometimes
makes it hard to give helpful, as opposed to my usual terse & grumpy:-),
comments....
It seems to me that the whole ethos of xslt is that you have a
"template" that is more or less a copy of what you are trying to
produce, into which you scatter the odd instruction from the xslt/xpath
where required. thus to generate an "a" element with an
attribute href you just do that:
<a href="
but at this point drop into Xpath (inside {})
{@xlink:href}"
and then finish off the element start tag
>
This just seems so much simpler than
<xsl:element name="a">
<xsl:attribute name="href">
<xsl:value-of select="@xlink:href"/>
</xsl:attribute>
That I would say that xsl:element and xsl:attribute only be used (or
shown to) advanced users who are needing to generate the
element/attribute names based on the run time behaviour of the
stylesheet rather than the far more usual case of generating fixed names
from the stylesheet or source.
David
_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service. For further
information visit http://www.star.net.uk/stats.asp or alternatively call
Star Internet for details on the Virus Scanning Service.
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list