Bug 28412, generate-id allowed in 3.0 use-when expr
authorabraaksm
Mon, 06 Apr 2015 16:32:38 +0200
changeset 916 7ba69990ffc9
parent 915 06595e9e7145
child 917 f36bb0709c98
Bug 28412, generate-id allowed in 3.0 use-when expr
tests/attr/use-when/_use-when-test-set.xml
tests/attr/use-when/use-when-0407a.xsl
--- a/tests/attr/use-when/_use-when-test-set.xml	Mon Apr 06 16:09:11 2015 +0200
+++ b/tests/attr/use-when/_use-when-test-set.xml	Mon Apr 06 16:32:38 2015 +0200
@@ -1333,7 +1333,7 @@
       </description>
       <created by="Michael Kay" on="2012-10-30"/>
       <modified by="Abel Braaksma" on="2015-03-23" change="Fixed test-part on generate-id (which reported generate-id, but tested fn:current)"/>
-      <modified by="Abel Braaksma" on="2015-03-23" change="Only applies to XSLT 2.0, most of these functions are allowed in XSLT 3.0, see use-when-0407a"/>
+      <modified by="Abel Braaksma" on="2015-03-23" change="Only applies to XSLT 2.0, generate-id is allowed in 3.0, see use-when-0407a"/>
       <environment ref="use-when-04"/>
       <dependencies>
          <spec value="XSLT20"/>
@@ -1361,14 +1361,14 @@
    
    <test-case name="use-when-0407a">
       <description>
-         XSLT30+ version of previous test
+         XSLT30+ version of previous test (generate-id is now available, it is part of FO30)
          Tests using function-available for generate-id, system-property, key, current,
          unparsed-entity-uri, and unparsed-entity-public-id in a use-when instruction.
       </description>
       <created by="Abel Braaksma" on="2015-03-23"/>
       <environment ref="use-when-04"/>
       <dependencies>
-         <spec value="XSLT20"/>
+         <spec value="XSLT30+"/>
       </dependencies>
       <test>
          <stylesheet file="use-when-0407a.xsl"/>
@@ -1382,7 +1382,7 @@
             <assert>/out/fa[@f="unparsed-entity-public-id"]="true"</assert>
             <assert>/out/fa[@f="system-property"]="true"</assert>
             <assert>not(/out/in[@f="current"])</assert>
-            <assert>not(/out/in[@f="generate-id"])</assert>
+            <assert>out/in[@f="generate-id"]="use-when evaluates to true!!!"</assert>
             <assert>not(/out/in[@f="key"])</assert>
             <assert>not(/out/in[@f="unparsed-entity-uri"])</assert>
             <assert>not(/out/in[@f="unparsed-entity-public-id"])</assert>
@@ -1450,7 +1450,7 @@
          <error code="XTSE0020"/>
       </result>
    </test-case>
-
+   
    <test-case name="use-when-0501">
       <description>Test case that uses use-when on xsl:sort to avoid ascending sort.</description>
       <created by="Michael Kay" on="2012-10-30"/>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/attr/use-when/use-when-0407a.xsl	Mon Apr 06 16:32:38 2015 +0200
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<t:transform xmlns:t="http://www.w3.org/1999/XSL/Transform" version="2.0">
+      <!-- Purpose:  Tests using function-available for generate-id,system-property, key, current
+  				unparsed-entity-uri, and unparsed-entity-public-id in an use-when instruction. -->
+
+      <t:template match="/" name="t:initial-template">
+            <out>
+                  <t:call-template name="temp"/>
+                  <in t:use-when="function-available('current')" f="current:">
+                        <t:value-of select="'use-when evaluates to true!!!'"
+                              use-when="function-available('current')"/>
+                  </in>
+                  <in t:use-when="function-available('generate-id')" f="generate-id">
+                        <t:value-of select="'use-when evaluates to true!!!'"
+                              use-when="function-available('generate-id')"/>
+                  </in>
+                  <in t:use-when="function-available('key')" f="key">
+                        <t:value-of select="'use-when evaluates to true!!!'"
+                              use-when="function-available('key')"/>
+                  </in>
+                  <in t:use-when="function-available('unparsed-entity-uri')" f="unparsed-entity-uri">
+                        <t:value-of select="'use-when evaluates to true!!!'"
+                              use-when="function-available('unparsed-entity-uri')"/>
+                  </in>
+                  <in t:use-when="function-available('unparsed-entity-public-id')"
+                        f="unparsed-entity-public-id">
+                        <t:value-of select="'use-when evaluates to true!!!'"
+                              use-when="function-available('unparsed-entity-public-id')"/>
+                  </in>
+                  <in t:use-when="function-available('system-property')" f="system-property">
+                        <t:value-of select="'use-when evaluates to true!!!'"
+                              use-when="function-available('system-property')"/>
+                  </in>
+            </out>
+      </t:template>
+
+      <t:template name="temp">
+            <fa f="current">
+                  <t:value-of select="function-available('current')"/>
+            </fa>
+            <fa f="generate-id">
+                  <t:value-of select="function-available('generate-id')"/>
+            </fa>
+            <fa f="key">
+                  <t:value-of select="function-available('key')"/>
+            </fa>
+            <fa f="unparsed-entity-uri">
+                  <t:value-of select="function-available('unparsed-entity-uri')"/>
+            </fa>
+            <fa f="unparsed-entity-public-id">
+                  <t:value-of select="function-available('unparsed-entity-public-id')"/>
+            </fa>
+            <fa f="system-property">
+                  <t:value-of select="function-available('system-property')"/>
+            </fa>
+      </t:template>
+</t:transform>