You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by fo...@locus.apache.org on 2000/02/29 10:41:20 UTC
cvs commit: xml-fop/src/codegen code-point-mapping.xsl font-file.xsl properties.xsl
fotis 00/02/29 01:41:20
Modified: src/codegen code-point-mapping.xsl font-file.xsl
properties.xsl
Log:
to utilize the Xalan parser rather than XT for autogeneration of the various Java files (submitted by Sean Timm)
Revision Changes Path
1.5 +24 -19 xml-fop/src/codegen/code-point-mapping.xsl
Index: code-point-mapping.xsl
===================================================================
RCS file: /home/cvs/xml-fop/src/codegen/code-point-mapping.xsl,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- code-point-mapping.xsl 1999/11/18 06:39:51 1.4
+++ code-point-mapping.xsl 2000/02/29 09:41:19 1.5
@@ -1,19 +1,24 @@
-<transform xmlns="http://www.w3.org/1999/XSL/Transform"
- xmlns:xt="http://www.jclark.com/xt" extension-element-prefixes="xt"
- version="1.0">
-<template match="font-mappings">
-<xt:document href="org/apache/fop/render/pdf/CodePointMapping.java" method="text">
-package org.apache.fop.render.pdf;
-
-public class CodePointMapping {
- public static char[] map;
-
- static {
- map = new char[65536];
-<for-each select="map[@unicode!='-1' and @win-ansi!='-1']"> map[<value-of select="@unicode"/>] = <value-of select="@win-ansi"/>;
-</for-each>
- }
-}
-</xt:document>
-</template>
-</transform>
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:lxslt="http://xml.apache.org/xslt"
+ xmlns:redirect="org.apache.xalan.xslt.extensions.Redirect"
+ extension-element-prefixes="redirect">
+<xsl:output method="text" />
+
+<xsl:template match="font-mappings">
+<redirect:write file="org/apache/fop/render/pdf/CodePointMapping.java">
+package org.apache.fop.render.pdf;
+
+public class CodePointMapping {
+ public static char[] map;
+
+ static {
+ map = new char[65536];
+<xsl:for-each select="map[@unicode!='-1' and @win-ansi!='-1']"> map[<xsl:value-of select="@unicode"/>] = <xsl:value-of select="@win-ansi"/>;
+</xsl:for-each>
+ }
+}
+</redirect:write>
+</xsl:template>
+</xsl:stylesheet>
+
1.3 +61 -56 xml-fop/src/codegen/font-file.xsl
Index: font-file.xsl
===================================================================
RCS file: /home/cvs/xml-fop/src/codegen/font-file.xsl,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- font-file.xsl 1999/11/17 01:32:13 1.2
+++ font-file.xsl 2000/02/29 09:41:19 1.3
@@ -1,56 +1,61 @@
-<transform xmlns="http://www.w3.org/1999/XSL/Transform"
- xmlns:xt="http://www.jclark.com/xt" extension-element-prefixes="xt"
- version="1.0">
-<template match="font-metrics">
-<variable name="class-name" select="class-name"/>
-<xt:document method="text" href="org/apache/fop/render/pdf/fonts/{$class-name}.java">
-package org.apache.fop.render.pdf.fonts;
-
-import org.apache.fop.render.pdf.Font;
-
-public class <value-of select="class-name"/> extends Font {
- private final static String fontName = "<value-of select="font-name"/>";
- private final static String encoding = "<value-of select="encoding"/>";
- private final static int capHeight = <value-of select="cap-height"/>;
- private final static int xHeight = <value-of select="x-height"/>;
- private final static int ascender = <value-of select="ascender"/>;
- private final static int descender = <value-of select="descender"/>;
- private final static int[] width;
-
- static {
- width = new int[256];
-<for-each select="widths/char"><variable name="char-name" select="@name"/><variable name="char-num" select="document('charlist.xml')/font-mappings/map[@adobe-name=$char-name]/@win-ansi"/><if test="$char-num!='-1'"> width[<value-of select="$char-num"/>] = <value-of select="@width"/>;
-</if></for-each>
- }
-
- public String encoding() {
- return encoding;
- }
-
- public String fontName() {
- return fontName;
- }
-
- public int getAscender() {
- return ascender;
- }
-
- public int getCapHeight() {
- return capHeight;
- }
-
- public int getDescender() {
- return descender;
- }
-
- public int getXHeight() {
- return xHeight;
- }
-
- public int width(int i) {
- return width[i];
- }
-}
-</xt:document>
-</template>
-</transform>
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:lxslt="http://xml.apache.org/xslt"
+ xmlns:redirect="org.apache.xalan.xslt.extensions.Redirect"
+ extension-element-prefixes="redirect">
+<xsl:output method="text" />
+
+<xsl:template match="font-metrics">
+<xsl:variable name="class-name" select="class-name"/>
+<redirect:write select="concat('org/apache/fop/render/pdf/fonts/', $class-name, '.java')">
+package org.apache.fop.render.pdf.fonts;
+
+import org.apache.fop.render.pdf.Font;
+
+public class <xsl:value-of select="class-name"/> extends Font {
+ private final static String fontName = "<xsl:value-of select="font-name"/>";
+ private final static String encoding = "<xsl:value-of select="encoding"/>";
+ private final static int capHeight = <xsl:value-of select="cap-height"/>;
+ private final static int xHeight = <xsl:value-of select="x-height"/>;
+ private final static int ascender = <xsl:value-of select="ascender"/>;
+ private final static int descender = <xsl:value-of select="descender"/>;
+ private final static int[] width;
+
+ static {
+ width = new int[256];
+<xsl:for-each select="widths/char"><xsl:variable name="char-name" select="@name"/><xsl:variable name="char-num" select="document('charlist.xml')/font-mappings/map[@adobe-name=$char-name]/@win-ansi"/><xsl:if test="$char-num!='-1'"> width[<xsl:value-of select="$char-num"/>] = <xsl:value-of select="@width"/>;
+</xsl:if></xsl:for-each>
+ }
+
+ public String encoding() {
+ return encoding;
+ }
+
+ public String fontName() {
+ return fontName;
+ }
+
+ public int getAscender() {
+ return ascender;
+ }
+
+ public int getCapHeight() {
+ return capHeight;
+ }
+
+ public int getDescender() {
+ return descender;
+ }
+
+ public int getXHeight() {
+ return xHeight;
+ }
+
+ public int width(int i) {
+ return width[i];
+ }
+}
+</redirect:write>
+</xsl:template>
+</xsl:stylesheet>
+
1.4 +142 -137 xml-fop/src/codegen/properties.xsl
Index: properties.xsl
===================================================================
RCS file: /home/cvs/xml-fop/src/codegen/properties.xsl,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- properties.xsl 1999/11/17 01:32:13 1.3
+++ properties.xsl 2000/02/29 09:41:19 1.4
@@ -1,137 +1,142 @@
-<transform xmlns="http://www.w3.org/1999/XSL/Transform"
- xmlns:xt="http://www.jclark.com/xt" element-prefixes="xt"
- version="1.0">
-<template match="property" priority="-1">
-<variable name="classname" select="class-name"/>
-<xt:document method="text" href="org/apache/fop/fo/properties/{$classname}.java">
-package org.apache.fop.fo.properties;
-
-import org.apache.fop.datatypes.*;
-import org.apache.fop.fo.*;
-import org.apache.fop.apps.FOPException;
-
-public class <value-of select="class-name"/> extends Property {
-
- public static class Maker extends Property.Maker {
- public boolean isInherited() { return <value-of select="inherited"/>; }
-
- public Property make(PropertyList propertyList, String value) throws FOPException {
-<choose>
-<when test="make">
- <variable name="datatype" select="datatype"/>
- <value-of select="$datatype"/> v;
-<if test="make/to-double">
- double d = toDouble(value);
-</if>
-<for-each select="make/if">
- if (value.equals("<value-of select="@match"/>")) {
- v = new <value-of select="$datatype"/>(<value-of select="."/>);
- }
-</for-each>
-<for-each select="make/else-if-number">
- else if (!Double.isNaN(d)) {
- v = new <value-of select="$datatype"/>( <value-of select="."/>);
- }
-</for-each>
- else {
- v = new <value-of select="datatype"/>(<value-of select="make/else"/>);
- }
- return new <value-of select="class-name"/>(propertyList, v);
-</when>
-<otherwise>
- return new <value-of select="class-name"/>(propertyList, new <value-of select="datatype"/>(value));
-</otherwise>
-</choose>
- }
-
- public Property make(PropertyList propertyList) throws FOPException {
- return make(propertyList, "<value-of select="default"/>");
- }
- }
-
- public static Property.Maker maker() {
- return new <value-of select="class-name"/>.Maker();
- }
-
- private <value-of select="datatype"/> value;
-
- public <value-of select="class-name"/>(PropertyList propertyList, <value-of select="datatype"/> explicitValue) {
- this.propertyList = propertyList;
- this.value = explicitValue;
- }
-
- public <value-of select="datatype"/> get<value-of select="datatype"/>() {
- return this.value;
- }
-
-}
-</xt:document>
-</template>
-
-<template match="property[datatype/enumeration]">
-<variable name="classname" select="class-name"/>
-<xt:document method="text" href="org/apache/fop/fo/properties/{$classname}.java">
-package org.apache.fop.fo.properties;
-
-import org.apache.fop.datatypes.*;
-import org.apache.fop.fo.*;
-import org.apache.fop.apps.FOPException;
-
-public class <value-of select="class-name"/> extends Property {
-<for-each select="datatype/enumeration/value">
- public final static int <value-of select="@const"/> = <number/>;</for-each>
-
- public static class Maker extends Property.Maker {
- public boolean isInherited() { return <value-of select="inherited"/>; }
-
- public Property make(PropertyList propertyList, String value) throws FOPException {
- int v;
- <for-each select="datatype/enumeration/value">
- if (value.equals("<value-of select="."/>")) { v = <value-of select="@const"/>; }
- else</for-each>
- {
- System.err.println("WARNING: Unknown value for <value-of select="name"/>: " + value);
- return make(propertyList, "<value-of select="default"/>");
- }
- return new <value-of select="class-name"/>(propertyList, v);
- }
-
- public Property make(PropertyList propertyList) throws FOPException {
- return make(propertyList, "<value-of select="default"/>");
- }
- <if test="derive">
- public Property compute(PropertyList propertyList) {
- Property computedProperty = null;
- Property correspondingProperty = propertyList.get("<value-of select="derive/@from"/>");
- if (correspondingProperty != null) {
- int correspondingValue = correspondingProperty.getEnum();
- <for-each select="derive/if">
- if (correspondingValue == <value-of select="@match"/>)
- computedProperty = new <value-of select="$classname"/>(propertyList, <value-of select="."/>);
- else</for-each>
- ;
- }
- return computedProperty;
- }
- </if>
- }
-
- public static Property.Maker maker() {
- return new <value-of select="class-name"/>.Maker();
- }
-
- private int value;
-
- public <value-of select="class-name"/>(PropertyList propertyList, int explicitValue) {
- this.propertyList = propertyList;
- this.value = explicitValue;
- }
-
- public int getEnum() {
- return this.value;
- }
-
-}
-</xt:document>
-</template>
-</transform>
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:lxslt="http://xml.apache.org/xslt"
+ xmlns:redirect="org.apache.xalan.xslt.extensions.Redirect"
+ extension-element-prefixes="redirect">
+<xsl:output method="text" />
+
+<xsl:template match="property" priority="-1">
+<xsl:variable name="classname" select="class-name"/>
+<redirect:write select="concat('org/apache/fop/fo/properties/', $classname, '.java')">
+package org.apache.fop.fo.properties;
+
+import org.apache.fop.datatypes.*;
+import org.apache.fop.fo.*;
+import org.apache.fop.apps.FOPException;
+
+public class <xsl:value-of select="class-name"/> extends Property {
+
+ public static class Maker extends Property.Maker {
+ public boolean isInherited() { return <xsl:value-of select="inherited"/>; }
+
+ public Property make(PropertyList propertyList, String value) throws FOPException {
+<xsl:choose>
+<xsl:when test="make">
+ <xsl:variable name="datatype" select="datatype"/>
+ <xsl:value-of select="$datatype"/> v;
+<xsl:if test="make/to-double">
+ double d = toDouble(value);
+</xsl:if>
+<xsl:for-each select="make/if">
+ if (value.equals("<xsl:value-of select="@match"/>")) {
+ v = new <xsl:value-of select="$datatype"/>(<xsl:value-of select="."/>);
+ }
+</xsl:for-each>
+<xsl:for-each select="make/else-if-number">
+ else if (!Double.isNaN(d)) {
+ v = new <xsl:value-of select="$datatype"/>( <xsl:value-of select="."/>);
+ }
+</xsl:for-each>
+ else {
+ v = new <xsl:value-of select="datatype"/>(<xsl:value-of select="make/else"/>);
+ }
+ return new <xsl:value-of select="class-name"/>(propertyList, v);
+</xsl:when>
+<xsl:otherwise>
+ return new <xsl:value-of select="class-name"/>(propertyList, new <xsl:value-of select="datatype"/>(value));
+</xsl:otherwise>
+</xsl:choose>
+ }
+
+ public Property make(PropertyList propertyList) throws FOPException {
+ return make(propertyList, "<xsl:value-of select="default"/>");
+ }
+ }
+
+ public static Property.Maker maker() {
+ return new <xsl:value-of select="class-name"/>.Maker();
+ }
+
+ private <xsl:value-of select="datatype"/> value;
+
+ public <xsl:value-of select="class-name"/>(PropertyList propertyList, <xsl:value-of select="datatype"/> explicitValue) {
+ this.propertyList = propertyList;
+ this.value = explicitValue;
+ }
+
+ public <xsl:value-of select="datatype"/> get<xsl:value-of select="datatype"/>() {
+ return this.value;
+ }
+
+}
+</redirect:write>
+</xsl:template>
+
+<xsl:template match="property[datatype/enumeration]">
+<xsl:variable name="classname" select="class-name"/>
+<redirect:write select="concat('org/apache/fop/fo/properties/', $classname, '.java')">
+package org.apache.fop.fo.properties;
+
+import org.apache.fop.datatypes.*;
+import org.apache.fop.fo.*;
+import org.apache.fop.apps.FOPException;
+
+public class <xsl:value-of select="class-name"/> extends Property {
+<xsl:for-each select="datatype/enumeration/value">
+ public final static int <xsl:value-of select="@const"/> = <xsl:number/>;</xsl:for-each>
+
+ public static class Maker extends Property.Maker {
+ public boolean isInherited() { return <xsl:value-of select="inherited"/>; }
+
+ public Property make(PropertyList propertyList, String value) throws FOPException {
+ int v;
+ <xsl:for-each select="datatype/enumeration/value">
+ if (value.equals("<xsl:value-of select="."/>")) { v = <xsl:value-of select="@const"/>; }
+ else</xsl:for-each>
+ {
+ System.err.println("WARNING: Unknown value for <xsl:value-of select="name"/>: " + value);
+ return make(propertyList, "<xsl:value-of select="default"/>");
+ }
+ return new <xsl:value-of select="class-name"/>(propertyList, v);
+ }
+
+ public Property make(PropertyList propertyList) throws FOPException {
+ return make(propertyList, "<xsl:value-of select="default"/>");
+ }
+ <xsl:if test="derive">
+ public Property compute(PropertyList propertyList) {
+ Property computedProperty = null;
+ Property correspondingProperty = propertyList.get("<xsl:value-of select="derive/@from"/>");
+ if (correspondingProperty != null) {
+ int correspondingValue = correspondingProperty.getEnum();
+ <xsl:for-each select="derive/if">
+ if (correspondingValue == <xsl:value-of select="@match"/>)
+ computedProperty = new <xsl:value-of select="$classname"/>(propertyList, <xsl:value-of select="."/>);
+ else</xsl:for-each>
+ ;
+ }
+ return computedProperty;
+ }
+ </xsl:if>
+ }
+
+ public static Property.Maker maker() {
+ return new <xsl:value-of select="class-name"/>.Maker();
+ }
+
+ private int value;
+
+ public <xsl:value-of select="class-name"/>(PropertyList propertyList, int explicitValue) {
+ this.propertyList = propertyList;
+ this.value = explicitValue;
+ }
+
+ public int getEnum() {
+ return this.value;
+ }
+
+}
+</redirect:write>
+</xsl:template>
+</xsl:stylesheet>
+