This relates to two of the distinguishing characteristics of XSLT, which
are closely related:
(a) it's a two-language system: XPath is embedded in XSLT, and as such
the combination isn't fully orthogonal (the embedding only works one
way; to invoke XSLT logic from XPath you have to go via functions or
variables)
(b) XSLT is an XML vocabulary, which means it can't play the kind of
games that XQuery plays, for example by allowing elements to be nested
within attributes.
These characteristics of XSLT of course have significant benefits, which
are presumably familiar to regulars on this list, but they also have
drawbacks.
Michael Kay
Saxonica
On 28/08/2012 21:55, Jakub Malý wrote:
Hi,
lets say, that somewhere in an XSLT context, I want to do this:
<xsl:sequence select="<my-cool-element>foo</m-cool-element>" />
But that is too insane, so I rewrite it like this:
<xsl:sequence select="element my-cool-element { 'foo' }" />
Only if constructors were supported in XPath.
But I CAN create new nodes in XSLT context!
So I end up with:
<xsl:function name="my:const-my-cool-element" as="element()">
<const-my-cool-element>foo</const-my-cool-element>
</xsl:function>
.
<xsl:sequence select="my:const-my-cool-element()" />
Yay :(
There is no question, really.
Jakub.
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--