[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?
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! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|