Subject: Re: [xsl] XPath element constructor From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx> Date: Tue, 28 Aug 2012 17:02:55 -0400 |
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.
-- Public XSLT, XSL-FO, UBL and code list classes in Europe -- Oct 2012 Contact us for world-wide XML consulting and instructor-led training Free 5-hour lecture: http://www.CraneSoftwrights.com/links/udemy.htm Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Google+ profile: https://plus.google.com/116832879756988317389/about Legal business disclaimers: http://www.CraneSoftwrights.com/legal
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] XPath element constructor, Jakub Malý | Thread | Re: [xsl] XPath element constructor, Imsieke, Gerrit, le- |
[xsl] XPath element constructor, Jakub Malý | Date | Re: [xsl] XPath element constructor, Imsieke, Gerrit, le- |
Month |