xsl-list
[Top] [All Lists]

Re: [xsl] passing a sequence as a parameter

2008-02-26 08:43:04
On 26/02/2008, Colin Adams <colinpauladams(_at_)googlemail(_dot_)com> wrote:
On 26/02/2008, David Carlisle <davidc(_at_)nag(_dot_)co(_dot_)uk> 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/

--~------------------------------------------------------------------
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>
--~--