Author: hermanns
Date: Thu Jul 20 10:24:46 2006
New Revision: 423998

URL: http://svn.apache.org/viewvc?rev=423998&view=rev
Log:
XSLTResult - 3 issues
o backport from WW-2.2.3
o fixed stylesheet
o reactivated commented test cases
Issue number:  WW-1255
Obtained from: 
Submitted by:  
Reviewed by:

Modified:
    
struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/xslt/XSLTResultTest.java
    struts/struts2/trunk/core/src/test/resources/XSLTResultTest3.xsl

Modified: 
struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/xslt/XSLTResultTest.java
URL: 
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/xslt/XSLTResultTest.java?rev=423998&r1=423997&r2=423998&view=diff
==============================================================================
--- 
struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/xslt/XSLTResultTest.java
 (original)
+++ 
struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/xslt/XSLTResultTest.java
 Thu Jul 20 10:24:46 2006
@@ -69,40 +69,38 @@
     }
 
     public void testSimpleTransform() throws Exception {
-        // TODO: XSLTResult does not work with JDK1.5
-
-        /*result.setParse(false);
+        result.setParse(false);
         result.setLocation("XSLTResultTest.xsl");
         result.execute(mai);
 
         String out = response.getContentAsString();
         assertTrue(out.startsWith("<?xml version=\"1.0\" 
encoding=\"UTF-8\"?>"));
-        assertTrue(out.indexOf("<result 
xmlns=\"http://www.w3.org/TR/xhtml1/strict\"";) > -1);*/
+        assertTrue(out.indexOf("<result 
xmlns=\"http://www.w3.org/TR/xhtml1/strict\"";) > -1);
     }
 
     public void testSimpleTransformParse() throws Exception {
-        /*result.setParse(true);
+        result.setParse(true);
         result.setLocation("${top.myLocation}");
         result.execute(mai);
 
         String out = response.getContentAsString();
         assertTrue(out.startsWith("<?xml version=\"1.0\" 
encoding=\"UTF-8\"?>"));
-        assertTrue(out.indexOf("<result 
xmlns=\"http://www.w3.org/TR/xhtml1/strict\"";) > -1);*/
+        assertTrue(out.indexOf("<result 
xmlns=\"http://www.w3.org/TR/xhtml1/strict\"";) > -1);
     }
 
     public void testTransform2() throws Exception {
-        /*result.setParse(false);
+        result.setParse(false);
         result.setLocation("XSLTResultTest2.xsl");
         result.execute(mai);
 
         String out = response.getContentAsString();
         assertTrue(out.startsWith("<?xml version=\"1.0\" 
encoding=\"UTF-8\"?>"));
         assertTrue(out.indexOf("<html 
xmlns=\"http://www.w3.org/TR/xhtml1/strict\"";) > -1);
-        assertTrue(out.indexOf("Hello Santa Claus how are you?") > -1);*/
+        assertTrue(out.indexOf("Hello Santa Claus how are you?") > -1);
     }
 
     public void testTransform3() throws Exception {
-        /*result.setParse(false);
+        result.setParse(false);
         result.setLocation("XSLTResultTest3.xsl");
         result.execute(mai);
 
@@ -110,9 +108,8 @@
         assertTrue(out.startsWith("<?xml version=\"1.0\" 
encoding=\"UTF-8\"?>"));
         assertTrue(out.indexOf("<html 
xmlns=\"http://www.w3.org/TR/xhtml1/strict\"";) > -1);
         assertTrue(out.indexOf("Hello Santa Claus how are you?") > -1);
-        assertTrue(out.indexOf("Struts in Action by Patrick and Jason") > 
-1);*/
-        // TODO: There is a bug in XSLTResult and having collections
-        //assertTrue(out.indexOf("XWork not in Action by Superman") > -1);
+        assertTrue(out.indexOf("WebWork in Action by Patrick and Jason") > -1);
+        assertTrue(out.indexOf("XWork not in Action by Superman") > -1);
     }
 
     protected void setUp() throws Exception {
@@ -162,7 +159,7 @@
 
         public List getBooks() {
             List list = new ArrayList();
-            list.add(new Book("Struts in Action", "Patrick and Jason"));
+            list.add(new Book("WebWork in Action", "Patrick and Jason"));
             list.add(new Book("XWork not in Action", "Superman"));
             return list;
         }
@@ -187,5 +184,4 @@
             return author;
         }
     }
-
 }

Modified: struts/struts2/trunk/core/src/test/resources/XSLTResultTest3.xsl
URL: 
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/resources/XSLTResultTest3.xsl?rev=423998&r1=423997&r2=423998&view=diff
==============================================================================
--- struts/struts2/trunk/core/src/test/resources/XSLTResultTest3.xsl (original)
+++ struts/struts2/trunk/core/src/test/resources/XSLTResultTest3.xsl Thu Jul 20 
10:24:46 2006
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
+<?xml version="1.0" encoding="UTF-8"?>
 <xsl:stylesheet version="1.0"
                 xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
                 xmlns="http://www.w3.org/TR/xhtml1/strict";>
@@ -9,11 +9,11 @@
                 Hello <xsl:value-of select="username"/> how are you?
                 <p/>
                 We have the following books:
-                <xsl:for-each select="books">
-                    <br/><xsl:value-of select="item/title"/> by <xsl:value-of 
select="item/author"/>.
+                <xsl:for-each select="books/item">
+                    <br/><xsl:value-of select="title"/> by <xsl:value-of 
select="author"/>.
                 </xsl:for-each>
             </body>
         </html>
     </xsl:template>
 
-</xsl:stylesheet>
\ No newline at end of file
+</xsl:stylesheet>


Reply via email to