Re: [xsl] passing a sequence as a parameter

Subject: Re: [xsl] passing a sequence as a parameter
From: "Colin Adams" <colinpauladams@xxxxxxxxxxxxxx>
Date: Tue, 26 Feb 2008 14:40:07 +0000
On 26/02/2008, Mukul Gandhi <gandhi.mukul@xxxxxxxxx> wrote:
> Hi Colin,

Hello Mukul,

>  On Tue, Feb 26, 2008 at 5:06 PM, Colin Adams
>  <colinpauladams@xxxxxxxxxxxxxx> wrote:
>  > Whether or not you can pass a sequence depends upon the processor. You
>  > can do this with Gestalt, as it allows you to pass any XPath
>  > expression. But you can't specify the type on the xsl:param with the
>  > as attribute, which is unfortunate.

>  I think, it's logical not to have type specification (with, as
>  attribute) on xsl:param instruction. We pass parameters to the
>  stylesheet from outside, and making the input environment XSLT/XPath
>  type aware doesn't appear logical to me.

I don't understand what you are saying.
Xsl:param can take an as attribute. If the valued passed in does not
match up to this type, then you get err:XTTE0590.

What I was talking about was that you cannot specify something like
as="(xs:boolean, xs:boolean, xs:integer)".

With a schema-aware process, you could specify a user-defined type,
which would do the trick. But not being very knowledgable about
schema-aware processing, I am not clear as to which schema would be
searched for global paranmeter checking.
In any case, Gestalt is not schema-aware, which is what I was getting
at. Sorry for not being clearer.

>As currently happening, whatever that is passed to the stylesheet to
>xsl:param variables, can be casted in the stylesheet to an appropriate
>type. I think, this is the correct design

Well I don't. There is no reason why the author of the stylesheet
should have to implement XPath parsing.

A solution is to pass in each memeber of the sequence as a separate
typed variable. This relies on be able to pass XPath values as
parameters. It will work with Gestalt and any other processor that has
such a facility.

Another solution that will work with a schema-aware processor is to
pass a URI to a parameters document, and have it validated. This is
much more clumsy from the point of view of the user of the interface
to the processor.

Best would be able to say:

as="(xs:boolean, xs:boolean, ...)"

Current Thread