OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Schema aware XSLT runtime error - is it a bug?

Dear list,
i have an schema aware XSLT script which leads to a runtime error: type
mismatch. I don't understand that error, and think it may be a bug, so I
wrote an entry in the Oxygen Forum (see
https://www.oxygenxml.com/forum/topic15402.html). The Oxygen staff has
tested with different versions of the Saxon-EE engine. All recent versions
of Saxon (9.5-9.8) report this incorrect type error. Now I am doubtful,
maybe I just don't understand what's going on.  Please help.

We have defined a type tns:T as an extension of xs:string.

<xs:complexType name="T">
            <xs:extension base="xs:string">
                <xs:attribute name="id" type="xs:ID"/>

We have an template which, when applied to some element, will return an
element of this type tns:T (at least, this is how I understand the @as
attribute of the template, as well as the @xsl:type attribute).

<xsl:template match="s" as="element(tns:t, tns:T)">
        <tns:t xsl:type="tns:T">
            <xsl:attribute name="id" select="concat('t-',
count(preceding-sibling::*) + 1)"/>
            <xsl:value-of select="."/>

This template is applied to populate a variable which can hold a sequence of
elements of this type.

<xsl:variable name="var" as="element(tns:t, tns:T)*">
            <xsl:apply-templates select="*"/>

Applied to an element with text content leads to a runtime error: System ID:
XTTE0570: Required item type of value of variable $var is
element(Q{http://www.example.com}t, Q{http://www.example.com}T); supplied
value has item type (element(Q{http://www.example.com}t) intersect
element(*, Q{http://www.w3.org/2001/XMLSchema}string))

I can't understand this error, since the template should return exactly the
required type. Further observation is, that an explicit call to a named
template with the same signature (that is, the same value for it's @as
attribute) works quite well.

What am I missing?

Frank Steimke

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS