]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
FOP-2271: XSL Infinite loop; test case: patch submitted by Simon Steiner.
authorLuis Bernardo <lbernardo@apache.org>
Fri, 12 Jul 2013 23:24:40 +0000 (23:24 +0000)
committerLuis Bernardo <lbernardo@apache.org>
Fri, 12 Jul 2013 23:24:40 +0000 (23:24 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1502725 13f79535-47bb-0310-9956-ffa450edef68

test/java/org/apache/fop/BasicDriverTestCase.java
test/xsl/iloop.xsl [new file with mode: 0644]

index a504821d4016dac397d2ea2c9d96791e1888a3fc..f149b451ee6f640e6be807b533a306d83f794f7e 100644 (file)
@@ -28,6 +28,7 @@ import javax.xml.transform.TransformerFactory;
 import javax.xml.transform.sax.SAXResult;
 import javax.xml.transform.stream.StreamSource;
 
+import org.apache.fop.apps.FOPException;
 import org.junit.Test;
 
 import org.apache.commons.io.output.ByteArrayOutputStream;
@@ -126,4 +127,16 @@ public class BasicDriverTestCase {
         assertTrue("Generated PDF has zero length", baout.size() > 0);
     }
 
+    @Test
+    public void testXSLILoop() throws Exception {
+        FOUserAgent foUserAgent = fopFactory.newFOUserAgent();
+        File xmlFile = new File(getBaseDir(), "test/xml/1.xml");
+        File xsltFile = new File(getBaseDir(), "test/xsl/iloop.xsl");
+        ByteArrayOutputStream baout = new ByteArrayOutputStream();
+        InputHandler handler = new InputHandler(xmlFile, xsltFile, null);
+        try {
+            handler.renderTo(foUserAgent, MimeConstants.MIME_PDF, baout);
+        } catch (FOPException e) {}
+    }
+
 }
diff --git a/test/xsl/iloop.xsl b/test/xsl/iloop.xsl
new file mode 100644 (file)
index 0000000..2efdfb0
--- /dev/null
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:fo="http://www.w3.org/1999/XSL/Format">
+  <xsl:template match="/">
+    <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
+      <fo:layout-master-set>
+        <fo:simple-page-master master-name="all" page-height="29.7cm" page-width="21cm" margin-top="1cm" margin-bottom="0.3cm" margin-left="1cm" margin-right="1cm">
+          <fo:region-body margin-top="0cm" margin-right="0cm" margin-bottom="1cm" margin-left="0cm" region-name="doesntexist" />
+
+        </fo:simple-page-master>
+      </fo:layout-master-set>
+      <fo:page-sequence master-reference="all">
+
+        <fo:flow flow-name="xsl-region-body">
+          <fo:block>
+            <xsl:apply-templates select="//region[@name='Main Region']" />
+          </fo:block>
+        </fo:flow>
+      </fo:page-sequence>
+    </fo:root>
+
+  </xsl:template>
+
+
+</xsl:stylesheet>
\ No newline at end of file