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/15 12:15:41 UTC

[xalan-java] branch xalan-j_xslt3.0 updated: adding few new working xalanj xslt 3.0 test cases, and doing minor changes to comments within an existing xalanj xslt 3.0 test case

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 04a13995 adding few new working xalanj xslt 3.0 test cases, and doing minor changes to comments within an existing xalanj xslt 3.0 test case
     new eead3f96 Merge pull request #29 from mukulga/xalan-j_xslt3.0_mukul
04a13995 is described below

commit 04a139950cee8c389b4a6f77b24b7d46e4bd1c00
Author: Mukul Gandhi <ga...@gmail.com>
AuthorDate: Sat Jul 15 17:41:33 2023 +0530

    adding few new working xalanj xslt 3.0 test cases, and doing minor changes to comments within an existing xalanj xslt 3.0 test case
---
 tests/for_expr/cities.xml                          |  6 ++++
 tests/for_expr/gold/test6.out                      |  1 +
 tests/for_expr/gold/test7.out                      |  1 +
 tests/for_expr/test1_b.xml                         | 33 ++++++++++++++++++++++
 .../test9.xsl => for_expr/test6.xsl}               | 26 ++++++++---------
 .../test9.xsl => for_expr/test7.xsl}               | 27 ++++++++----------
 tests/org/apache/xalan/xpath3/ForExprTests.java    | 20 +++++++++++++
 tests/quantified_expr/test9.xsl                    |  4 +--
 8 files changed, 86 insertions(+), 32 deletions(-)

diff --git a/tests/for_expr/cities.xml b/tests/for_expr/cities.xml
new file mode 100644
index 00000000..f50fc2ce
--- /dev/null
+++ b/tests/for_expr/cities.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<cities>
+  <city>Los Angeles</city>
+  <city>Paris</city>
+</cities>
+
diff --git a/tests/for_expr/gold/test6.out b/tests/for_expr/gold/test6.out
new file mode 100644
index 00000000..809818db
--- /dev/null
+++ b/tests/for_expr/gold/test6.out
@@ -0,0 +1 @@
+<?xml version="1.0" encoding="UTF-8"?><emp count="5">John John Mary Peter Mark</emp>
diff --git a/tests/for_expr/gold/test7.out b/tests/for_expr/gold/test7.out
new file mode 100644
index 00000000..2b664218
--- /dev/null
+++ b/tests/for_expr/gold/test7.out
@@ -0,0 +1 @@
+<?xml version="1.0" encoding="UTF-8"?><result count="4">from: Los Angeles  to: Los Angeles from: Los Angeles  to: Paris from: Paris  to: Los Angeles from: Paris  to: Paris</result>
diff --git a/tests/for_expr/test1_b.xml b/tests/for_expr/test1_b.xml
new file mode 100644
index 00000000..a5b5bc92
--- /dev/null
+++ b/tests/for_expr/test1_b.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<company>
+  <office location="Boston">
+    <employee>
+      <first_name>John</first_name>
+      <last_name>Smith</last_name>
+      <age>25</age>
+    </employee>
+    <employee>
+      <first_name>John</first_name>
+      <last_name>Jones</last_name>
+      <age>30</age>
+    </employee>
+  </office>
+  <office location="Vienna">
+    <employee>
+      <first_name>Mary</first_name>
+      <last_name>Brown</last_name>
+      <age>30</age>
+    </employee>
+    <employee>
+      <first_name>Peter</first_name>
+      <last_name>Davis</last_name>
+      <age>34</age>
+    </employee>
+    <employee>
+      <first_name>Mark</first_name>
+      <last_name>Mason</last_name>
+      <age>44</age>
+    </employee>
+  </office>
+</company>
+
diff --git a/tests/quantified_expr/test9.xsl b/tests/for_expr/test6.xsl
similarity index 66%
copy from tests/quantified_expr/test9.xsl
copy to tests/for_expr/test6.xsl
index 859b9d91..72406034 100644
--- a/tests/quantified_expr/test9.xsl
+++ b/tests/for_expr/test6.xsl
@@ -1,28 +1,24 @@
 <?xml version="1.0"?>
 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                 version="3.0">
-                
+
    <!-- Author: mukulg@apache.org -->
    
-   <!-- use with test1_f.xml -->
+   <!-- use with test1_b.xml -->
    
-   <!-- An XSLT stylesheet test case, to test the XPath 3.1 quantified 
-        expressions 'some' and 'every'.
+   <!-- This XSLT stylesheet test, illustrates an XPath 3.1 "for" 
+        expression evaluation.
         
-        This XSLT stylesheet example, borrows XPath quantified
-        expression examples from https://www.altova.com/. -->
-
+        This XSLT stylesheet, borrows an XPath "for" expression 
+        example from https://www.altova.com/. -->
+   
    <xsl:output method="xml" indent="yes"/>
 
    <xsl:template match="/">
-     <result>
-        <one>      
-           <xsl:value-of select="some $i in /company/office/employee satisfies $i/age lt 30"/>
-        </one>
-        <two>      
-           <xsl:value-of select="every $i in /company/office/employee satisfies $i/age gt 30"/>
-        </two>
-     </result>  
+      <xsl:variable name="names" select="for $i in company/office/employee return $i/first_name"/>
+      <emp count="{count($names)}">
+         <xsl:value-of select="$names"/>
+      </emp>
    </xsl:template>
    
    <!--
diff --git a/tests/quantified_expr/test9.xsl b/tests/for_expr/test7.xsl
similarity index 66%
copy from tests/quantified_expr/test9.xsl
copy to tests/for_expr/test7.xsl
index 859b9d91..e150f707 100644
--- a/tests/quantified_expr/test9.xsl
+++ b/tests/for_expr/test7.xsl
@@ -1,28 +1,25 @@
 <?xml version="1.0"?>
 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                 version="3.0">
-                
+
    <!-- Author: mukulg@apache.org -->
    
-   <!-- use with test1_f.xml -->
+   <!-- use with cities.xml -->
    
-   <!-- An XSLT stylesheet test case, to test the XPath 3.1 quantified 
-        expressions 'some' and 'every'.
+   <!-- This XSLT stylesheet test, illustrates an XPath 3.1 "for" 
+        expression evaluation.
         
-        This XSLT stylesheet example, borrows XPath quantified
-        expression examples from https://www.altova.com/. -->
-
+        This XSLT stylesheet, borrows an XPath "for" expression 
+        example from https://www.altova.com/. -->
+   
    <xsl:output method="xml" indent="yes"/>
 
    <xsl:template match="/">
-     <result>
-        <one>      
-           <xsl:value-of select="some $i in /company/office/employee satisfies $i/age lt 30"/>
-        </one>
-        <two>      
-           <xsl:value-of select="every $i in /company/office/employee satisfies $i/age gt 30"/>
-        </two>
-     </result>  
+      <xsl:variable name="resultSeq" select="for $x in /cities/city, $y in /cities/city 
+                                                                 return concat('from: ', $x, '  to: ', $y)"/>
+      <result count="{count($resultSeq)}">
+         <xsl:value-of select="$resultSeq"/>
+      </result>
    </xsl:template>
    
    <!--
diff --git a/tests/org/apache/xalan/xpath3/ForExprTests.java b/tests/org/apache/xalan/xpath3/ForExprTests.java
index e1e747b8..b176ee64 100644
--- a/tests/org/apache/xalan/xpath3/ForExprTests.java
+++ b/tests/org/apache/xalan/xpath3/ForExprTests.java
@@ -96,5 +96,25 @@ public class ForExprTests extends XslTransformTestsUtil {
         
         runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
     }
+    
+    @Test
+    public void xslForExprTest6() {
+        String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test1_b.xml"; 
+        String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test6.xsl";
+        
+        String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test6.out";                
+        
+        runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
+    }
+    
+    @Test
+    public void xslForExprTest7() {
+        String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "cities.xml"; 
+        String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test7.xsl";
+        
+        String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test7.out";                
+        
+        runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
+    }
 
 }
diff --git a/tests/quantified_expr/test9.xsl b/tests/quantified_expr/test9.xsl
index 859b9d91..56b68d8c 100644
--- a/tests/quantified_expr/test9.xsl
+++ b/tests/quantified_expr/test9.xsl
@@ -9,8 +9,8 @@
    <!-- An XSLT stylesheet test case, to test the XPath 3.1 quantified 
         expressions 'some' and 'every'.
         
-        This XSLT stylesheet example, borrows XPath quantified
-        expression examples from https://www.altova.com/. -->
+        This XSLT stylesheet, borrows the XPath quantified expression 
+        examples from https://www.altova.com/. -->
 
    <xsl:output method="xml" indent="yes"/>
 


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