[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
Hi all,
I typed $foobar as xs:string but I'd like to restrict the possible values to "foo" or "bar".
I know it's possible to define such a constrain in a xsd schema, but is there a way to do that in xpath2 ?
This typing is important because the returned element() is selected from a xsl:choose on $foobar value (with no otherwise) :
And I get such a parsing error on my xslt :
XTTE0570: Conditional expression: If none of the conditions is satisfied, an empty
sequence will be returned, but this is not allowed [...]
Should I import my own schema to my xsl to define my special type derived from xs:string ?
Thanks for your advices,
Matthieu.
[xsl] strong typed variable with restriction ?
Subject: [xsl] strong typed variable with restriction ? From: Matthieu Ricaud-Dussarget <matthieu.ricaud@xxxxxxxxx> Date: Wed, 02 Feb 2011 11:16:18 +0100 |
Hi all,
I have a xsl:function which : - must return a element() - has a string param "foobar".
I typed $foobar as xs:string but I'd like to restrict the possible values to "foo" or "bar".
I know it's possible to define such a constrain in a xsd schema, but is there a way to do that in xpath2 ?
This typing is important because the returned element() is selected from a xsl:choose on $foobar value (with no otherwise) :
My code looks like : <xsl:function name="igs:get-css-rule" as="element()"> <xsl:param name="foobar" as="xs:string"/> <!--(foo|bar)--> <xsl:choose> <xsl:when test="$foobar='foo'"> <xsl:sequence select="igs:get-my-foo-item()"/> </xsl:when> <xsl:when test="$css='bar'"> <xsl:sequence select="igs:get-my-bar-item()"/> </xsl:when> </xsl:choose> </xsl:function>
And I get such a parsing error on my xslt :
XTTE0570: Conditional expression: If none of the conditions is satisfied, an empty
sequence will be returned, but this is not allowed [...]
Should I import my own schema to my xsl to define my special type derived from xs:string ?
Thanks for your advices,
Matthieu.
-- Matthieu Ricaud IGS-CP Service Livre numirique
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] EMF, Andriy Gerasika | Thread | Re: [xsl] strong typed variable wit, Andrew Welch |
Re: [xsl] EMF, Andriy Gerasika | Date | Re: [xsl] strong typed variable wit, Andrew Welch |
Month |