Re: [xsl] passing a sequence as a parameter

Subject: Re: [xsl] passing a sequence as a parameter
From: "Andrew Welch" <andrew.j.welch@xxxxxxxxx>
Date: Tue, 26 Feb 2008 15:42:30 +0000
On 26/02/2008, Colin Adams <colinpauladams@xxxxxxxxxxxxxx> wrote:
> On 26/02/2008, David Carlisle <davidc@xxxxxxxxx> wrote:
>
>  >  Actually I didn't understand Colin's statement that you couldn't use as=
>  >  in this context, Colin, did you mean that was a restriction in the
>  >  language or just of gesalt?
>
>
> Both.
>
>  That is, the language doesn't allow you to specify a type of two
>  booleans followed by an integer, for example.
>
>  But you could do this via a user-defined type in a schema-aware
>  processor. And Gestalt is not schema-aware.

Even with a schema-aware processor you couldn't pass a pre-typed
atomic sequence as a parameter could you?  You could pass elements
that were typed, but not atomics?  Maybe an example would help.

A way around it is to pass in a delimited string and the create the
sequence yourself:

<xsl:param name="str" select="'foo, 1'" as="xs:string"/>

<xsl:variable name="input">
	<xsl:variable name="tokens" select="tokenize($str, ',')"/>	
	<xsl:sequence select="(xs:string($tokens[1]), xs:integer($tokens[2]))"/>
</xsl:variable>


-- 
Andrew Welch
http://andrewjwelch.com
Kernow: http://kernowforsaxon.sf.net/

Current Thread