Combined example 1 Xalan stylesheets and just using a parameter to select XSL formatter.
authorTony Graham
Sun, 09 Feb 2014 19:52:25 +0000
changeset 28 5509d620d54f
parent 27 c34d37f2d7a1
child 29 22ac957faf1a
Combined example 1 Xalan stylesheets and just using a parameter to select XSL formatter.
FOPRunXSLTExt/examples/example1_xalan.xsl
FOPRunXSLTExt/examples/example1_xalan_ahf61.xsl
FOPRunXSLTExt/examples/example1_xalan_fop10.xsl
FOPRunXSLTExt/examples/ppl-extensions.xsl
FOPRunXSLTExt/examples/runxalan_ahf61.sh.in
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/FOPRunXSLTExt/examples/example1_xalan.xsl	Sun Feb 09 19:52:25 2014 +0000
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- ============================================================= -->
+<!-- FOPRunXSLTExt Xalan example 1                                 -->
+<!--                                                               -->
+<!-- See http://www.w3.org/community/ppl/wiki/FOPRunXSLTExt        -->
+<!--                                                               -->
+<!-- Requires Xalan 2.7 or later and FOP 1.0                       -->
+<!--                                                               -->
+<!-- Produced by the Print and Page Layout Community Group @ W3C   -->
+<!-- ============================================================= -->
+<xsl:stylesheet
+    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    version="1.0"
+    xmlns:ppl="http://www.w3.org/community/ppl/ns/"
+    xmlns:fo="http://www.w3.org/1999/XSL/Format"
+    exclude-result-prefixes="ppl">
+
+<xsl:import href="ppl-extensions.xsl" />
+
+<xsl:param name="dest_dir" />
+<xsl:param name="area_tree_filename" />
+
+<xsl:variable name="area_tree_file"
+	      select="concat($dest_dir, '/', $area_tree_filename)" />
+
+<xsl:template match="/">
+  <!-- Make FO from source document. -->
+  <xsl:variable name="foTree">
+    <fo:root>
+      <fo:layout-master-set>
+	<fo:simple-page-master master-name="test-page">
+	  <fo:region-body margin="1in"/>
+	</fo:simple-page-master>
+      </fo:layout-master-set>
+
+      <fo:page-sequence master-reference="test-page">
+	<fo:flow flow-name="xsl-region-body">
+	  <xsl:apply-templates select="example" />
+	</fo:flow>
+      </fo:page-sequence>
+    </fo:root>
+  </xsl:variable>
+
+  <xsl:call-template name="ppl:area-tree">
+    <xsl:with-param name="fo-tree" select="$foTree"/>
+  </xsl:call-template>
+</xsl:template>
+
+<xsl:template match="header">
+  <fo:block font-size="14pt" font-family="verdana" color="red"
+	    space-before="5mm" space-after="5mm">
+    <xsl:apply-templates/>
+  </fo:block>
+</xsl:template>
+
+<xsl:template match="paragraph">
+  <fo:block text-indent="5mm" font-family="verdana" font-size="12pt">
+    <xsl:apply-templates/>
+  </fo:block>
+</xsl:template>
+
+</xsl:stylesheet>
\ No newline at end of file
--- a/FOPRunXSLTExt/examples/example1_xalan_ahf61.xsl	Sun Feb 09 17:55:14 2014 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,63 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- ============================================================= -->
-<!-- FOPRunXSLTExt Xalan example 1                                 -->
-<!--                                                               -->
-<!-- See http://www.w3.org/community/ppl/wiki/FOPRunXSLTExt        -->
-<!--                                                               -->
-<!-- Requires Xalan 2.7 or later and FOP 1.0                       -->
-<!--                                                               -->
-<!-- Produced by the Print and Page Layout Community Group @ W3C   -->
-<!-- ============================================================= -->
-<xsl:stylesheet
-    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
-    version="1.0"
-    xmlns:fo="http://www.w3.org/1999/XSL/Format"
-    xmlns:xalan="http://xml.apache.org/xalan"
-    xmlns:runahf="runahf">
-
-<xalan:component prefix="runahf" functions="areaTree" elements="">
-  <xalan:script lang="javaclass"
-		src="xalan://org.w3c.ppl.xslt.ext.ahf.xalan" />
-</xalan:component>
-
-<xsl:param name="dest_dir" />
-<xsl:param name="area_tree_filename" />
-
-<xsl:variable name="area_tree_file"
-	      select="concat($dest_dir, '/', $area_tree_filename)" />
-
-<xsl:template match="/">
-  <!-- Make FO from source document. -->
-  <xsl:variable name="foTree">
-    <fo:root>
-      <fo:layout-master-set>
-	<fo:simple-page-master master-name="test-page">
-	  <fo:region-body margin="1in"/>
-	</fo:simple-page-master>
-      </fo:layout-master-set>
-
-      <fo:page-sequence master-reference="test-page">
-	<fo:flow flow-name="xsl-region-body">
-	  <xsl:apply-templates select="example" />
-	</fo:flow>
-      </fo:page-sequence>
-    </fo:root>
-  </xsl:variable>
-
-  <xsl:copy-of select="runahf:RunAHFXalan.areaTree($foTree)"/>
-</xsl:template>
-
-<xsl:template match="header">
-  <fo:block font-size="14pt" font-family="verdana" color="red"
-	    space-before="5mm" space-after="5mm">
-    <xsl:apply-templates/>
-  </fo:block>
-</xsl:template>
-
-<xsl:template match="paragraph">
-  <fo:block text-indent="5mm" font-family="verdana" font-size="12pt">
-    <xsl:apply-templates/>
-  </fo:block>
-</xsl:template>
-
-</xsl:stylesheet>
\ No newline at end of file
--- a/FOPRunXSLTExt/examples/example1_xalan_fop10.xsl	Sun Feb 09 17:55:14 2014 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,63 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- ============================================================= -->
-<!-- FOPRunXSLTExt Xalan example 1                                 -->
-<!--                                                               -->
-<!-- See http://www.w3.org/community/ppl/wiki/FOPRunXSLTExt        -->
-<!--                                                               -->
-<!-- Requires Xalan 2.7 or later and FOP 1.0                       -->
-<!--                                                               -->
-<!-- Produced by the Print and Page Layout Community Group @ W3C   -->
-<!-- ============================================================= -->
-<xsl:stylesheet
-    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
-    version="1.0"
-    xmlns:fo="http://www.w3.org/1999/XSL/Format"
-    xmlns:xalan="http://xml.apache.org/xalan"
-    xmlns:runfop="runfop">
-
-<xalan:component prefix="runfop" functions="areaTree" elements="">
-  <xalan:script lang="javaclass"
-		src="xalan://org.w3c.ppl.xslt.ext.fop.xalan" />
-</xalan:component>
-
-<xsl:param name="dest_dir" />
-<xsl:param name="area_tree_filename" />
-
-<xsl:variable name="area_tree_file"
-	      select="concat($dest_dir, '/', $area_tree_filename)" />
-
-<xsl:template match="/">
-  <!-- Make FO from source document. -->
-  <xsl:variable name="foTree">
-    <fo:root>
-      <fo:layout-master-set>
-	<fo:simple-page-master master-name="test-page">
-	  <fo:region-body margin="1in"/>
-	</fo:simple-page-master>
-      </fo:layout-master-set>
-
-      <fo:page-sequence master-reference="test-page">
-	<fo:flow flow-name="xsl-region-body">
-	  <xsl:apply-templates select="example" />
-	</fo:flow>
-      </fo:page-sequence>
-    </fo:root>
-  </xsl:variable>
-
-  <xsl:copy-of select="runfop:RunFOPXalan.areaTree($foTree)"/>
-</xsl:template>
-
-<xsl:template match="header">
-  <fo:block font-size="14pt" font-family="verdana" color="red"
-	    space-before="5mm" space-after="5mm">
-    <xsl:apply-templates/>
-  </fo:block>
-</xsl:template>
-
-<xsl:template match="paragraph">
-  <fo:block text-indent="5mm" font-family="verdana" font-size="12pt">
-    <xsl:apply-templates/>
-  </fo:block>
-</xsl:template>
-
-</xsl:stylesheet>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/FOPRunXSLTExt/examples/ppl-extensions.xsl	Sun Feb 09 19:52:25 2014 +0000
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- ============================================================= -->
+<!-- ppl-extensions.xsl                                            -->
+<!--                                                               -->
+<!-- See http://www.w3.org/community/ppl/wiki/XSLTExtensions       -->
+<!--                                                               -->
+<!-- Requires Xalan 2.7 or later or Saxon 9.5 or later and         -->
+<!-- FOP 1.0 or later or Antenna House AHF 6.1 or later.           -->
+<!--                                                               -->
+<!-- Produced by the Print and Page Layout Community Group @ W3C   -->
+<!--                                                               -->
+<!-- License: W3C license                                          -->
+<!-- ============================================================= -->
+<xsl:stylesheet
+    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    version="2.0"
+    xmlns:ppl="http://www.w3.org/community/ppl/ns/"
+    xmlns:fo="http://www.w3.org/1999/XSL/Format"
+    xmlns:xalan="http://xml.apache.org/xalan"
+    xmlns:runfop="runfop"
+    xmlns:runahf="runahf"
+    exclude-result-prefixes="ppl xalan runahf runfop">
+
+<!-- Formatter to run.  Used when selecting which extension function
+     to run. -->
+<!-- Seems that you can't use namespaced parameters on the Xalan
+     command line, otherwise would have been ppl:formatter. -->
+<xsl:param name="ppl-formatter" select="'fop'" />
+
+<xalan:component prefix="runfop" functions="areaTree" elements="">
+  <xalan:script lang="javaclass"
+		src="xalan://org.w3c.ppl.xslt.ext.fop.xalan" />
+</xalan:component>
+
+<xalan:component prefix="runahf" functions="areaTree" elements="">
+  <xalan:script lang="javaclass"
+		src="xalan://org.w3c.ppl.xslt.ext.ahf.xalan" />
+</xalan:component>
+
+<xsl:template name="ppl:area-tree">
+  <xsl:param name="fo-tree"/>
+
+  <xsl:choose>
+    <xsl:when test="$ppl-formatter = 'ahf'">
+      <xsl:copy-of select="runahf:RunAHFXalan.areaTree($fo-tree)"/>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:copy-of select="runfop:RunFOPXalan.areaTree($fo-tree)"/>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+</xsl:stylesheet>
\ No newline at end of file
--- a/FOPRunXSLTExt/examples/runxalan_ahf61.sh.in	Sun Feb 09 17:55:14 2014 +0000
+++ b/FOPRunXSLTExt/examples/runxalan_ahf61.sh.in	Sun Feb 09 19:52:25 2014 +0000
@@ -40,4 +40,4 @@
 CP=$CP:@[email protected]
 CP=$CP:@[email protected]
 
-java -cp $CP org.apache.xalan.xslt.Process -IN $1 -XSL $2 -OUT $3
+java -cp $CP org.apache.xalan.xslt.Process -IN $1 -XSL $2 -OUT $3 -PARAM ppl-formatter ahf