You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by mu...@apache.org on 2023/07/05 16:43:50 UTC

[xalan-java] branch xalan-j_xslt3.0 updated: minor xalanj code refactoring on this branch. adding a new working test case as well, for xpath 3.1 dynamic function calls implementation.

This is an automated email from the ASF dual-hosted git repository.

mukulg pushed a commit to branch xalan-j_xslt3.0
in repository https://gitbox.apache.org/repos/asf/xalan-java.git


The following commit(s) were added to refs/heads/xalan-j_xslt3.0 by this push:
     new 7fec5495 minor xalanj code refactoring on this branch. adding a new working test case as well, for xpath 3.1 dynamic function calls implementation.
     new 771b7ba0 Merge pull request #19 from mukulga/xalan-j_xslt3.0_mukul
7fec5495 is described below

commit 7fec5495bcd9e6bc5f6567769dc062f8f5705a00
Author: Mukul Gandhi <ga...@gmail.com>
AuthorDate: Wed Jul 5 22:08:38 2023 +0530

    minor xalanj code refactoring on this branch. adding a new working test case as well, for xpath 3.1 dynamic function calls implementation.
---
 src/org/apache/xpath/compiler/XPathParser.java     |  6 +++---
 .../gold/test1.out                                 |  0
 .../gold/test2.out                                 |  0
 .../gold/test3.out                                 |  0
 .../gold/test5.out                                 |  0
 tests/dynamic_function_call/gold/test6.out         | 14 +++++++++++++
 .../test1.xsl                                      |  0
 .../test1_a.xml                                    |  0
 .../test1_b.xml                                    |  0
 tests/dynamic_function_call/test1_c.xml            | 24 ++++++++++++++++++++++
 .../test2.xsl                                      |  0
 .../test3.xsl                                      |  0
 .../test4.xsl                                      |  0
 .../test5.xsl                                      |  0
 .../test1.xsl => dynamic_function_call/test6.xsl}  |  8 +++++---
 .../xalan/xpath3/DynamicFunctionCallTests.java     | 14 +++++++++++--
 16 files changed, 58 insertions(+), 8 deletions(-)

diff --git a/src/org/apache/xpath/compiler/XPathParser.java b/src/org/apache/xpath/compiler/XPathParser.java
index a454cf7a..a833379f 100644
--- a/src/org/apache/xpath/compiler/XPathParser.java
+++ b/src/org/apache/xpath/compiler/XPathParser.java
@@ -84,10 +84,10 @@ public class XPathParser
    * decisions. The elements of this array are certain XPath operator names 
    * that need this support.
    */
-  static final String[] XPATH_OP_ARR = new String[] {"div", "or", "and", "mod", "to", 
-                                                         "eq", "ne", "lt", "gt", "le", "ge"};
+  private static final String[] XPATH_OP_ARR = new String[] {"div", "or", "and", "mod", "to", 
+                                                                "eq", "ne", "lt", "gt", "le", "ge"};
   
-  List<String> fXpathOpArrTokensList = null;
+  private List<String> fXpathOpArrTokensList = null;
   
   static InlineFunction fInlineFunction = null;
   
diff --git a/tests/dynamic_function_calls/gold/test1.out b/tests/dynamic_function_call/gold/test1.out
similarity index 100%
rename from tests/dynamic_function_calls/gold/test1.out
rename to tests/dynamic_function_call/gold/test1.out
diff --git a/tests/dynamic_function_calls/gold/test2.out b/tests/dynamic_function_call/gold/test2.out
similarity index 100%
rename from tests/dynamic_function_calls/gold/test2.out
rename to tests/dynamic_function_call/gold/test2.out
diff --git a/tests/dynamic_function_calls/gold/test3.out b/tests/dynamic_function_call/gold/test3.out
similarity index 100%
rename from tests/dynamic_function_calls/gold/test3.out
rename to tests/dynamic_function_call/gold/test3.out
diff --git a/tests/dynamic_function_calls/gold/test5.out b/tests/dynamic_function_call/gold/test5.out
similarity index 100%
rename from tests/dynamic_function_calls/gold/test5.out
rename to tests/dynamic_function_call/gold/test5.out
diff --git a/tests/dynamic_function_call/gold/test6.out b/tests/dynamic_function_call/gold/test6.out
new file mode 100644
index 00000000..191f5e0c
--- /dev/null
+++ b/tests/dynamic_function_call/gold/test6.out
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?><result>
+  <item>
+     <a>5</a>
+     <b>2</b>
+   </item>
+  <item>
+     <a>3</a>
+     <b>1</b>
+   </item>
+  <item>
+     <a>7</a>
+     <b>4</b>
+   </item>
+</result>
diff --git a/tests/dynamic_function_calls/test1.xsl b/tests/dynamic_function_call/test1.xsl
similarity index 100%
copy from tests/dynamic_function_calls/test1.xsl
copy to tests/dynamic_function_call/test1.xsl
diff --git a/tests/dynamic_function_calls/test1_a.xml b/tests/dynamic_function_call/test1_a.xml
similarity index 100%
rename from tests/dynamic_function_calls/test1_a.xml
rename to tests/dynamic_function_call/test1_a.xml
diff --git a/tests/dynamic_function_calls/test1_b.xml b/tests/dynamic_function_call/test1_b.xml
similarity index 100%
rename from tests/dynamic_function_calls/test1_b.xml
rename to tests/dynamic_function_call/test1_b.xml
diff --git a/tests/dynamic_function_call/test1_c.xml b/tests/dynamic_function_call/test1_c.xml
new file mode 100644
index 00000000..dbef26d9
--- /dev/null
+++ b/tests/dynamic_function_call/test1_c.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<list>
+   <item>
+     <a>1</a>
+     <b>5</b>
+   </item>
+   <item>
+     <a>5</a>
+     <b>2</b>
+   </item>
+   <item>
+     <a>3</a>
+     <b>1</b>
+   </item>
+   <item>
+     <a>2</a>
+     <b>7</b>
+   </item>
+   <item>
+     <a>7</a>
+     <b>4</b>
+   </item>
+</list>
+ 
\ No newline at end of file
diff --git a/tests/dynamic_function_calls/test2.xsl b/tests/dynamic_function_call/test2.xsl
similarity index 100%
rename from tests/dynamic_function_calls/test2.xsl
rename to tests/dynamic_function_call/test2.xsl
diff --git a/tests/dynamic_function_calls/test3.xsl b/tests/dynamic_function_call/test3.xsl
similarity index 100%
rename from tests/dynamic_function_calls/test3.xsl
rename to tests/dynamic_function_call/test3.xsl
diff --git a/tests/dynamic_function_calls/test4.xsl b/tests/dynamic_function_call/test4.xsl
similarity index 100%
rename from tests/dynamic_function_calls/test4.xsl
rename to tests/dynamic_function_call/test4.xsl
diff --git a/tests/dynamic_function_calls/test5.xsl b/tests/dynamic_function_call/test5.xsl
similarity index 100%
rename from tests/dynamic_function_calls/test5.xsl
rename to tests/dynamic_function_call/test5.xsl
diff --git a/tests/dynamic_function_calls/test1.xsl b/tests/dynamic_function_call/test6.xsl
similarity index 85%
rename from tests/dynamic_function_calls/test1.xsl
rename to tests/dynamic_function_call/test6.xsl
index 6334dd64..63e601c0 100644
--- a/tests/dynamic_function_calls/test1.xsl
+++ b/tests/dynamic_function_call/test6.xsl
@@ -4,16 +4,18 @@
                 
    <!-- Author: mukulg@apache.org -->
    
+   <!-- use with test1_c.xml -->
+   
    <!-- An XSLT stylesheet, to test the XPath 3.1 dynamic function 
         calls. -->                
 
    <xsl:output method="xml" indent="yes"/>
    
-   <xsl:variable name="func1" select="function($x, $y) { $x + $y }"/>
+   <xsl:variable name="gThan" select="function($x, $y) { $x gt $y }"/>
 
-   <xsl:template match="/">
+   <xsl:template match="/list">
       <result>
-         <xsl:value-of select="$func1(2, 3)"/>  
+         <xsl:copy-of select="item[$gThan(a, b)]"/> 
       </result>
    </xsl:template>
    
diff --git a/tests/org/apache/xalan/xpath3/DynamicFunctionCallTests.java b/tests/org/apache/xalan/xpath3/DynamicFunctionCallTests.java
index e05fb409..a26fb91f 100644
--- a/tests/org/apache/xalan/xpath3/DynamicFunctionCallTests.java
+++ b/tests/org/apache/xalan/xpath3/DynamicFunctionCallTests.java
@@ -31,9 +31,9 @@ import org.junit.Test;
  */
 public class DynamicFunctionCallTests extends XslTransformTestsUtil {        
     
-    private static final String XSL_TRANSFORM_INPUT_DIRPATH = XSLConstants.XSL_TRANSFORM_INPUT_DIRPATH_PREFIX + "dynamic_function_calls/";
+    private static final String XSL_TRANSFORM_INPUT_DIRPATH = XSLConstants.XSL_TRANSFORM_INPUT_DIRPATH_PREFIX + "dynamic_function_call/";
     
-    private static final String XSL_TRANSFORM_GOLD_DIRPATH = XSLConstants.XSL_TRANSFORM_GOLD_DIRPATH_PREFIX + "dynamic_function_calls/gold/";
+    private static final String XSL_TRANSFORM_GOLD_DIRPATH = XSLConstants.XSL_TRANSFORM_GOLD_DIRPATH_PREFIX + "dynamic_function_call/gold/";
 
     @BeforeClass
     public static void setUpBeforeClass() throws Exception {
@@ -96,5 +96,15 @@ public class DynamicFunctionCallTests extends XslTransformTestsUtil {
         
         runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
     }
+    
+    @Test
+    public void xslDynamicFunctionCallTest6() {
+        String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test1_c.xml"; 
+        String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test6.xsl";
+        
+        String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test6.out";                
+        
+        runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
+    }
 
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xalan.apache.org
For additional commands, e-mail: commits-help@xalan.apache.org