Test using zero-length string as a map key default tip
authorMichael Kay <mike@saxonica.com>
Tue, 05 Dec 2017 23:18:12 +0000
changeset 1792 df4de18a7be9
parent 1791 98e61a8aba13
Test using zero-length string as a map key
tests/type/maps/_maps-test-set.xml
tests/type/maps/maps-016.xsl
--- a/tests/type/maps/_maps-test-set.xml	Tue Dec 05 23:13:57 2017 +0000
+++ b/tests/type/maps/_maps-test-set.xml	Tue Dec 05 23:18:12 2017 +0000
@@ -200,6 +200,17 @@
          <assert-xml><![CDATA[<out>22</out>]]></assert-xml>
       </result>
    </test-case>
+   
+   <test-case name="maps-016">
+      <description>map:contains vs map:get</description>
+      <created by="Michael Kay" on="2017-11-22"/>
+      <test>
+         <stylesheet file="maps-016.xsl"/>
+      </test>
+      <result>
+         <assert-xml><![CDATA[<out><contains>false</contains><get/></out>]]></assert-xml>
+      </result>
+   </test-case>
       
    <test-case name="maps-901a">
       <description>map:new() (without args) should throw error (since Oct 2014 LCWD)</description>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/type/maps/maps-016.xsl	Tue Dec 05 23:18:12 2017 +0000
@@ -0,0 +1,22 @@
+<xsl:stylesheet version="3.0" 
+    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:map="http://www.w3.org/2005/xpath-functions/map"
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    xmlns:f="http://local-functions.org/"
+    exclude-result-prefixes="map xs f">
+    
+    <xsl:variable name="m" as="map(*)" select="
+      map{ 'Document/Options/Updated':'true'  }"/>
+    
+
+    <xsl:template name="xsl:initial-template">
+      <out>
+        <contains><xsl:value-of select="map:contains($m, '')"/></contains>
+        <get><xsl:value-of select="map:get($m, '')"/></get>
+      </out>
+    </xsl:template>
+    
+ 
+
+    
+</xsl:stylesheet>
\ No newline at end of file