xsl-list
[Top] [All Lists]

[xsl] Type of a variable containing values of mixed types

2015-04-13 05:39:23
Hi,

I only seldom write XSLT (and specifically only 2.0) so there are many
aspects of it that I am still not familiar with. After reading
<http://www.ibm.com/developerworks/library/x-schemaawarexslt/index.html>
I am forcing myself to declare the type of variables, parameters and,
sometimes, templates. I have immediately seen the benefit of it as
transformations I thought were simple and bug-free fail all over the
place revealing cases I did not account for.

How can I enforce that a variable contains a particular bunch of mixed
types? Say:

    <xsl:variable name="MY_VAR" as="…">
        <xsl:value-of select="42"/>
        <xsl:value-of select="13"/>
        <xsl:value-of select="hello"/>
    </xsl:variable>

Is there a way to enforce, with the attribute `as`, that the variable
contains a series of integers and a string (or, even, particularly 2
integers and 1 string) or else have the transformation fail?

I am using Saxon-HE 9.2.1.2J.

—
Jorge
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--

<Prev in Thread] Current Thread [Next in Thread>