New test where initial-mode is in a used package
authorMichael Kay <mike@saxonica.com>
Mon, 10 Jul 2017 22:45:01 +0100
changeset 1718 4e84e25cfbdc
parent 1717 7af84915cce5
child 1719 b50f6e67e87b
New test where initial-mode is in a used package
tests/decl/override/_override-test-set.xml
tests/decl/override/override-v-015a.xsl
tests/decl/override/override-v-015b.xsl
--- a/tests/decl/override/_override-test-set.xml	Mon Jul 10 22:44:04 2017 +0100
+++ b/tests/decl/override/_override-test-set.xml	Mon Jul 10 22:45:01 2017 +0100
@@ -907,6 +907,24 @@
       </result>
    </test-case>
    
+   <test-case name="override-v-015">
+      <description>Overriding a param, calling in a non-default mode. Saxon issue 3338.</description>
+      <created by="Michael Kay after Mark Dunn" on="2016-09-05"/>
+      <environment>
+         <source role=".">
+            <content><![CDATA[<doc><a foo="bar">Lorem Ipsum</a></doc>]]></content>
+         </source>
+      </environment>
+      <test>
+         <package file="override-v-015a.xsl" role="principal"/>
+         <package file="override-v-015b.xsl" role="secondary"/>
+         <initial-mode name="transform"/>
+      </test>
+      <result>
+         <assert-xml><![CDATA[<override-success><doc><a foo="bar">Lorem Ipsum</a></doc></override-success>]]></assert-xml>
+      </result>
+   </test-case>
+   
    <test-case name="override-as-001">
       <description>Successful override of a public attribute-set</description>
       <created by="Michael Kay" on="2015-02-28"/>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/decl/override/override-v-015a.xsl	Mon Jul 10 22:45:01 2017 +0100
@@ -0,0 +1,20 @@
+<?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:xd="http://www.oxygenxml.com/ns/doc/xsl" 
+    version="3.0">
+    
+    <xsl:use-package name="http://www.oup.com/testParamOverride" package-version="0.1">
+        <xsl:accept component="mode" names="transform" visibility="public"/>
+        
+        <xsl:override>
+            <xsl:param name="newRootElement" select="'override-success'" as="xs:string"/>
+        </xsl:override>
+    </xsl:use-package>
+    
+    <xsl:template match="/">
+        <xsl:apply-templates select="/" mode="transform"/>
+    </xsl:template>
+    
+</xsl:stylesheet>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/decl/override/override-v-015b.xsl	Mon Jul 10 22:45:01 2017 +0100
@@ -0,0 +1,30 @@
+<xsl:package 
+    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
+    xmlns:xs="http://www.w3.org/2001/XMLSchema" 
+    name="http://www.oup.com/testParamOverride" 
+    package-version="0.1" 
+    exclude-result-prefixes="#all" 
+    version="3.0">
+    
+    <xsl:mode name="transform" visibility="public"/>
+    
+    <xsl:param name="newRootElement" as="xs:string" required="no" select="'null'"/>
+    
+    <xsl:template match="/" mode="transform">
+        <xsl:message>New root element: <xsl:value-of select="$newRootElement"/></xsl:message>
+        <xsl:element name="{$newRootElement}">
+            <xsl:apply-templates mode="#current"/>
+        </xsl:element>
+    </xsl:template>
+    
+    <xsl:template match="*" mode="transform">
+        <xsl:copy>
+            <xsl:apply-templates select="@*,child::node()" mode="#current"/>
+        </xsl:copy>
+    </xsl:template>
+    
+    <xsl:template match="@* | comment() | processing-instruction() | text()" mode="transform">
+        <xsl:copy-of select="."/>
+    </xsl:template>
+    
+</xsl:package>
\ No newline at end of file