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

RE: Schema aware XSLT runtime error - is it a bug?

  • From: <mike@saxonica.com>
  • To: <f-steimke@berger-und-steimke.de>, <xml-dev@l...>
  • Date: Tue, 16 Jan 2018 18:54:26 -0000

RE:  Schema aware XSLT runtime error - is it a bug?

Saxon is creating the <tns:t> element with a type annotation of xs:string (rather than tns:T). The code does this quite deliberately, but I cannot find anything in the specs to justify it. The spec that defines how type annotations are established is the XDM data model, ยง3.3.1.1, which in effect says that the type annotation is the same as the [type definition] in the PSVI; the XSD 1.1 spec says this is the same as the "governing type" used for validating the element, which is clearly tns:T.

Michael Kay

----- Original Message -----
From: Frank Steimke [mailto:f-steimke@berger-und-steimke.de]
To: xml-dev@l...
Cc: support@o...
Sent: Tue, 16 Jan 2018 18:41:19 +0100
Subject: 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


XML-DEV is a publicly archived, unmoderated list hosted by OASIS
to support XML implementation and development. To minimize
spam in the archives, you must subscribe before posting.

[Un]Subscribe/change address: http://www.oasis-open.org/mlmanage/
Or unsubscribe: xml-dev-unsubscribe@l...
subscribe: xml-dev-subscribe@l...
List archive: http://lists.xml.org/archives/xml-dev/
List Guidelines: http://www.oasis-open.org/maillists/guidelines.php

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


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.
First Name
Last Name
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.