ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 13859] New: - XSLT: processing multiple files is broken
Date Tue, 22 Oct 2002 18:13:00 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=13859>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=13859

XSLT: processing multiple files is broken

           Summary: XSLT: processing multiple files is broken
           Product: Ant
           Version: 1.5.1
          Platform: All
               URL: http://www.linofee.org/~elkner/jakarta/
        OS/Version: All
            Status: NEW
          Severity: Blocker
          Priority: Other
         Component: Core tasks
        AssignedTo: ant-dev@jakarta.apache.org
        ReportedBy: elkner@linofee.org


When I use the following task with the original jakarta-ant-1.5.1-bin.tar.gz
and JDK 1.4.1 I get NullPointerExceptions shown below, when ant tries to
process the 2nd file in the implicit fileset:

    <xslt basedir="${src.codegen.dir}"
      destdir="${build.codegen.dir}/${codebase}/render/pdf/"
      style="${src.codegen.dir}/font-file.xsl"
      extension=".java"
      includes="fonts/*.xml"
      classpathref="classpath.extensions">
      <param name="encoding" expression="${textfontencoding}"/>
    </xslt>

-------Exception starts------
...
     [xslt] Processing
/home/elkner/prog/fop/src/codegen/fonts/CourierBoldOblique.xml to
/home/elkner/prog/fop/build/codegen/org/apache/fop/render/pdf/fonts/CourierBoldOblique.java
     [xslt] Loading stylesheet /home/elkner/prog/fop/src/codegen/font-file.xsl
     [xslt] Processing
/home/elkner/prog/fop/src/codegen/fonts/CourierOblique.xml to
/home/elkner/prog/fop/build/codegen/org/apache/fop/render/pdf/fonts/CourierOblique.java
     [xslt] home/elkner/prog/fop/src/codegen/font-file.xsl:27:103: Fatal Error!
Unknown error in XPath Cause: java.lang.NullPointerException
     [xslt] : Fatal Error! Fatal error during transformation Cause: Fatal error
during transformation
     [xslt] Failed to process
/home/elkner/prog/fop/src/codegen/fonts/CourierOblique.xml

BUILD FAILED
file:/home/elkner/prog/fop/build.xml:228: Fatal error during transformation
-------Exception stops-------



-----debug output start -----
...
     [xslt] Transforming into
/home/elkner/prog/fop/build/codegen/org/apache/fop/render/pdf
     [xslt] Processing /home/elkner/prog/fop/src/codegen/fonts/CourierBold.xml
to
/home/elkner/prog/fop/build/codegen/org/apache/fop/render/pdf/fonts/CourierBold.java
     [xslt] Loading stylesheet /home/elkner/prog/fop/src/codegen/font-file.xsl
     [xslt] Processing
/home/elkner/prog/fop/src/codegen/fonts/CourierBoldOblique.xml to
/home/elkner/prog/fop/build/codegen/org/apache/fop/render/pdf/fonts/CourierBoldOblique.java
     [xslt] home/elkner/prog/fop/src/codegen/font-file.xsl:27:103: Fatal Error!
Unknown error in XPath Cause: java.lang.NullPointerException
     [xslt] : Fatal Error! Fatal error during transformation Cause: Fatal error
during transformation
     [xslt] Failed to process
/home/elkner/prog/fop/src/codegen/fonts/CourierBoldOblique.xml

BUILD FAILED
file:/home/elkner/prog/fop/build.xml:228: Fatal error during transformation
        at org.apache.tools.ant.taskdefs.XSLTProcess.process(XSLTProcess.java:476)
        at org.apache.tools.ant.taskdefs.XSLTProcess.execute(XSLTProcess.java:240)
        at org.apache.tools.ant.Task.perform(Task.java:319)
        at org.apache.tools.ant.Target.execute(Target.java:309)
        at org.apache.tools.ant.Target.performTasks(Target.java:336)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1250)
        at org.apache.tools.ant.Main.runBuild(Main.java:610)
        at org.apache.tools.ant.Main.start(Main.java:196)
        at org.apache.tools.ant.Main.main(Main.java:235)
Caused by: Fatal error during transformation
        at
org.apache.tools.ant.taskdefs.optional.TraXLiaison.fatalError(TraXLiaison.java:241)
        at
org.apache.xalan.transformer.TransformerImpl.transformNode(TransformerImpl.java:1226)
        at
org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:638)
        at
org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1088)
        at
org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1066)
        at
org.apache.tools.ant.taskdefs.optional.TraXLiaison.transform(TraXLiaison.java:188)
        at org.apache.tools.ant.taskdefs.XSLTProcess.process(XSLTProcess.java:466)
        ... 9 more
...
 Nested Exception ---
; SystemID: file:///home/elkner/prog/fop/src/codegen/font-file.xsl; Line#: 27;
Column#: 103
javax.xml.transform.TransformerException: Unknown error in XPath
        at org.apache.xpath.XPath.bool(XPath.java:411)
        at org.apache.xalan.templates.ElemChoose.execute(ElemChoose.java:162)
        at
org.apache.xalan.templates.ElemApplyTemplates.transformSelectedNodes(ElemApplyTemplates.java:423)
        at
org.apache.xalan.templates.ElemApplyTemplates.execute(ElemApplyTemplates.java:226)
        at
org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2182)
        at
org.apache.xalan.transformer.TransformerImpl.applyTemplateToNode(TransformerImpl.java:2008)
        at
org.apache.xalan.transformer.TransformerImpl.transformNode(TransformerImpl.java:1171)
        at
org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:638)
        at
org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1088)
        at
org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1066)
        at
org.apache.tools.ant.taskdefs.optional.TraXLiaison.transform(TraXLiaison.java:188)
        at org.apache.tools.ant.taskdefs.XSLTProcess.process(XSLTProcess.java:466)
        at org.apache.tools.ant.taskdefs.XSLTProcess.execute(XSLTProcess.java:240)
        at org.apache.tools.ant.Task.perform(Task.java:319)
        at org.apache.tools.ant.Target.execute(Target.java:309)
        at org.apache.tools.ant.Target.performTasks(Target.java:336)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1250)
        at org.apache.tools.ant.Main.runBuild(Main.java:610)
        at org.apache.tools.ant.Main.start(Main.java:196)
        at org.apache.tools.ant.Main.main(Main.java:235)
Caused by: java.lang.NullPointerException
        at org.apache.xpath.objects.XNodeSet.getStringFromNode(XNodeSet.java:235)
        at org.apache.xpath.objects.XNodeSet.compare(XNodeSet.java:619)
        at org.apache.xpath.objects.XNodeSet.notEquals(XNodeSet.java:725)
        at org.apache.xpath.objects.XObject.notEquals(XObject.java:678)
        at org.apache.xpath.operations.NotEquals.operate(NotEquals.java:82)
        at org.apache.xpath.operations.Operation.execute(Operation.java:146)
        at org.apache.xpath.Expression.bool(Expression.java:208)
        at org.apache.xpath.XPath.bool(XPath.java:388)
        ... 20 more
---------
...
---------
java.lang.NullPointerException
        at org.apache.xpath.objects.XNodeSet.getStringFromNode(XNodeSet.java:235)
        at org.apache.xpath.objects.XNodeSet.compare(XNodeSet.java:619)
        at org.apache.xpath.objects.XNodeSet.notEquals(XNodeSet.java:725)
        at org.apache.xpath.objects.XObject.notEquals(XObject.java:678)
        at org.apache.xpath.operations.NotEquals.operate(NotEquals.java:82)
        at org.apache.xpath.operations.Operation.execute(Operation.java:146)
        at org.apache.xpath.Expression.bool(Expression.java:208)
        at org.apache.xpath.XPath.bool(XPath.java:388)
        at org.apache.xalan.templates.ElemChoose.execute(ElemChoose.java:162)
        at
org.apache.xalan.templates.ElemApplyTemplates.transformSelectedNodes(ElemApplyTemplates.java:423)
        at
org.apache.xalan.templates.ElemApplyTemplates.execute(ElemApplyTemplates.java:226)
        at
org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2182)
        at
org.apache.xalan.transformer.TransformerImpl.applyTemplateToNode(TransformerImpl.java:2008)
        at
org.apache.xalan.transformer.TransformerImpl.transformNode(TransformerImpl.java:1171)
        at
org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:638)
        at
org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1088)
        at
org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1066)
        at
org.apache.tools.ant.taskdefs.optional.TraXLiaison.transform(TraXLiaison.java:188)
        at org.apache.tools.ant.taskdefs.XSLTProcess.process(XSLTProcess.java:466)
        at org.apache.tools.ant.taskdefs.XSLTProcess.execute(XSLTProcess.java:240)
        at org.apache.tools.ant.Task.perform(Task.java:319)
        at org.apache.tools.ant.Target.execute(Target.java:309)
        at org.apache.tools.ant.Target.performTasks(Target.java:336)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1250)
        at org.apache.tools.ant.Main.runBuild(Main.java:610)
        at org.apache.tools.ant.Main.start(Main.java:196)
        at org.apache.tools.ant.Main.main(Main.java:235)
-----debug output end -----


-----src/codegen/font-file.xsl snippez starts ---
...
<xsl:stylesheet version="1.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

  <xsl:output method="text"/>

  <xsl:param name="encoding" select="/font-metrics/encoding"/>
  <xsl:variable name="native-encoding" select="/font-metrics/encoding"/>
  <xsl:variable name="glyphs"
select="document('encodings.xml')/encoding-set/encoding[@id=$encoding]/glyph"/>

  <xsl:template match="font-metrics">
package org.apache.fop.render.pdf.fonts;

import org.apache.fop.render.pdf.Font;
import org.apache.fop.render.pdf.CodePointMapping;

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:choose><xsl:when test="$encoding
!= $native-encoding">"<xsl:value-of
select="$encoding"/>"</xsl:when><xsl:otherwise>null</xsl:otherwise></xsl:choose>;
-----src/codegen/font-file.xsl snippez starts ---

The last line is line 27, where the ant breaks.



So I guess, there was something wrong with the parameters and tried to
reconfigure the transformer, but without any luck.
So the only fix I found to get it work is the following patch:

diff -Nbaur
jakarta-ant-1.5.1/src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java
ant-1.5.1/src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java
--- jakarta-ant-1.5.1/src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java 
Wed Oct  2 17:09:03 2002
+++ ant-1.5.1/src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java   Tue Oct
22 02:26:48 2002
@@ -707,7 +707,7 @@
      * @exception BuildException if the stylesheet cannot be loaded.
      */
     protected void configureLiaison(File stylesheet) throws BuildException {
-        if (stylesheetLoaded) {
+        if (stylesheetLoaded && ! (liaison instanceof TraXLiaison)) {
             return;
         }
         stylesheetLoaded = true;


I'm not sure, whether this is more crimson or more ant related ..., however,
this needs to be fixed ASAP, since many people use JDK1.4.1 + ant, only.

Regards,
jens.

Complete bugreport is on http://www.linofee.org/~elkner/jakarta/

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message