Error case: sorting a sequence containing untypedAtomics and dates
authorMichael Kay <mike@saxonica.com>
Mon, 18 Sep 2017 23:27:28 +0100
changeset 1755 734cb9e04b55
parent 1753 11ea335f61ab
child 1756 77b6da0b5d67
Error case: sorting a sequence containing untypedAtomics and dates
tests/insn/sort/_sort-test-set.xml
tests/insn/sort/sort-080.xsl
--- a/tests/insn/sort/_sort-test-set.xml	Wed Aug 30 11:10:24 2017 +0100
+++ b/tests/insn/sort/_sort-test-set.xml	Mon Sep 18 23:27:28 2017 +0100
@@ -1463,4 +1463,18 @@
       </result>
    </test-case>
    
+   <test-case name="sort-080">
+      <description>Attempt to sort a sequence containing untyped attributes and typed dates</description>
+      <created by="Michael Kay" on="2017-09-18"/>
+      <dependencies>
+         <spec value="XSLT30+"/>
+      </dependencies>
+      <test>
+         <stylesheet file="sort-080.xsl"/>
+      </test>
+      <result>
+         <error code="XTDE1030"/>
+      </result>
+   </test-case>
+   
 </test-set>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/insn/sort/sort-080.xsl	Mon Sep 18 23:27:28 2017 +0100
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="3.0" xmlns:f="http://f.com/"
+   xmlns:xs="http://www.w3.org/2001/XMLSchema" exclude-result-prefixes="#all" expand-text="true">
+   <!-- Purpose: Attempt to sort a sequence containing untyped attribute nodes and dates.-->
+   <!-- Should fail because "lt" comparison between xs:untypedAtomic and xs:date is not allowed. -->
+   
+   <xsl:variable name="in">
+      <e at="2017-01-05"/>
+      <e at="2014-01-02"/>
+      <e at="2016-03-02"/>     
+   </xsl:variable>
+
+   <xsl:template name="xsl:initial-template">
+      <out>
+         <xsl:for-each select="$in/e/@at, xs:date('2011-12-31')">
+            <xsl:sort select="."/>
+            <item>{.}</item>
+         </xsl:for-each>
+      </out>
+   </xsl:template>
+
+</xsl:transform>