[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Schema aware XSLT runtime error - is it a bug?

  • From: "Frank Steimke" <f-steimke@berger-und-steimke.de>
  • To: <xml-dev@lists.xml.org>
  • Date: Tue, 16 Jan 2018 18:41:19 +0100

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:simpleContent>
            <xs:extension base="xs:string">
                <xs:attribute name="id" type="xs:ID"/>
            </xs:extension>
        </xs:simpleContent>
</xs:complexType>

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="."/>
        </tns:t>
</xsl:template>

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="*"/>
</xsl:variable>

Applied to an element with text content leads to a runtime error: System ID:
C:\tmp\possible-bug-with-types-variable\possible-bug-with-types-variable\ext
ension-with-var.xsl
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?

Sincerely,
Frank Steimke
  



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


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.