[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] XPath element constructor

Subject: Re: [xsl] XPath element constructor
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Tue, 28 Aug 2012 17:02:55 -0400

Is there somewhere where you think you can use:

<xsl:sequence ...>

... but where you cannot use in its place:



I think not.

And while the function does allow you to return the same sequence multiple times, you start your post with the consideration of XPath having constructors.

The <xsl:sequence> is available to you in an element context when you want to use XPath to build something rather than using XSLT and XML to build something. Hence, XPath doesn't need a constructor to do what I think you were trying first to do.

Does this help?

. . . . . . . . . . Ken

At 2012-08-28 22:55 +0200, =?iso-8859-2?Q?Jakub_Mal=FD?= wrote:
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()">
<xsl:sequence select="my:const-my-cool-element()" />

Yay :(
There is no question, really.


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