Test ambiguous rule match on maps default tip
authorMichael Kay <mike@saxonica.com>
Mon, 19 Mar 2018 12:50:41 +0000
changeset 1831 3e38aedfd704
parent 1830 aa9e0e31a964
Test ambiguous rule match on maps
tests/attr/match/_match-test-set.xml
tests/attr/match/match-260.xsl
--- a/tests/attr/match/_match-test-set.xml	Mon Mar 19 12:50:09 2018 +0000
+++ b/tests/attr/match/_match-test-set.xml	Mon Mar 19 12:50:41 2018 +0000
@@ -4787,5 +4787,19 @@
          <assert-xml><![CDATA[<out><ok a="wrong"/></out>]]></assert-xml>
       </result>
    </test-case>
+   
+   <test-case name="match-260">
+      <description>Ambiguous rule match on maps</description>
+      <created by="Michael Kay" on="2018-03-15"/>
+      <dependencies>
+         <spec value="XSLT30+"/>
+      </dependencies>
+      <test>
+         <stylesheet file="match-260.xsl"/>
+      </test>
+      <result>
+         <error code="XTDE0540"/>
+      </result>
+   </test-case>
  
 </test-set>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/attr/match/match-260.xsl	Mon Mar 19 12:50:41 2018 +0000
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
+    xmlns:xs="http://www.w3.org/2001/XMLSchema" 
+    xmlns:math="http://www.w3.org/2005/xpath-functions/math" 
+    exclude-result-prefixes="xs math" 
+    version="3.0">
+    
+    <xsl:param name="input" as="xs:string">{ "prop1" : "value 1", "prop2" : "value 2" }</xsl:param>
+    
+    <xsl:output method="json" indent="yes"/>
+    
+    <xsl:mode on-multiple-match="fail"/>
+    
+    <xsl:template name="xsl:initial-template" match="/">
+        <out>
+            <xsl:apply-templates select="parse-json($input)"/>
+        </out>
+    </xsl:template>
+    
+    <xsl:template match=".[. instance of map(*)]">
+        <A/>
+    </xsl:template>
+    
+    <xsl:template match=".[. instance of map(*)]">
+        <B/>
+    </xsl:template>
+    
+</xsl:stylesheet>
\ No newline at end of file