Home » Java » Java XSLT Processer Throwing Error On New Server

Java XSLT Processer Throwing Error On New Server

Posted by: admin September 29, 2018 Leave a comment

Questions:

I have this XSLT code:

<xsl:template name="citation">
    <fo:block font-size="8pt" margin-top="6pt">
        <xsl:for-each select="parent/block">
            <xsl:variable name="suffix" select="concat(' ', name/suffix)"/>
            <xsl:value-of select="name/surname"/><xsl:value-of select="if ($suffix != ' ') then $suffix else ''" />,<xsl:text> </xsl:text> <xsl:value-of select="n_s:get_initials(name/given-names/text())"/>
        </xsl:for-each>
    </fo:block>
</xsl:template>

I’m receiving this error when running via Apache FOP 1.1 and Java 1.8:

Required attribute 'select' is missing.

Which is for the line starting with:

<xsl:value-of select="name/surname"/>

I think this is because my XSLT processor is running 1.0 instead of 2.0 but I’m not sure about that. I have three other servers running this code fine. They all use FOP 1.1 as well and have varying versions of Java (1.6, 1.7, and 1.8).

I used:

java com.sun.org.apache.xalan.internal.xslt.EnvironmentCheck

to decipher if I was/wasn’t using the proper XSLT processor but the result looked the same as my other servers.

Here’s the return from the failing server:

#---- BEGIN writeEnvironmentReport($Revision: 1.10 $): Useful stuff found: ----
sun.boot.class.path=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.171-8.b10.amzn2.x86_64/jre/lib/resources.jar:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.171-8.b10.amzn2.x86_64/jre/lib/rt.jar:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.171-8.b10.amzn2.x86_64/jre/lib/sunrsasign.jar:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.171-8.b10.amzn2.x86_64/jre/lib/jsse.jar:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.171-8.b10.amzn2.x86_64/jre/lib/jce.jar:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.171-8.b10.amzn2.x86_64/jre/lib/charsets.jar:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.171-8.b10.amzn2.x86_64/jre/lib/jfr.jar:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.171-8.b10.amzn2.x86_64/jre/classes
java.version=1.8.0_171
version.xalan2_2=Xalan Java 2.7.0
version.xerces1=not-present
version.xalan1=not-present
java.class.path=.
version.DOM=3.0
version.crimson=not-present
version.ant=not-present
version.SAX=2.0
version.xerces2=Xerces-J 2.7.1
java.ext.dirs=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.171-8.b10.amzn2.x86_64/jre/lib/ext:/usr/java/packages/lib/ext
version.JAXP=1.4
version.xalan2x=not-present
#----- END writeEnvironmentReport: Useful properties found: -----

Here’s the return from one of the functional servers:

#---- BEGIN writeEnvironmentReport($Revision: 1.10 $): Useful stuff found: ----
sun.boot.class.path=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.161-0.b14.el7_4.x86_64/jre/lib/resources.jar:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.161-0.b14.el7_4.x86_64/jre/lib/rt.jar:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.161-0.b14.el7_4.x86_64/jre/lib/sunrsasign.jar:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.161-0.b14.el7_4.x86_64/jre/lib/jsse.jar:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.161-0.b14.el7_4.x86_64/jre/lib/jce.jar:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.161-0.b14.el7_4.x86_64/jre/lib/charsets.jar:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.161-0.b14.el7_4.x86_64/jre/lib/jfr.jar:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.161-0.b14.el7_4.x86_64/jre/classes
java.version=1.8.0_161
version.xalan2_2=Xalan Java 2.7.0
version.xerces1=not-present
version.xalan1=not-present
java.class.path=.
version.DOM=3.0
version.crimson=not-present
version.ant=not-present
version.SAX=2.0
version.xerces2=Xerces-J 2.7.1
java.ext.dirs=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.161-0.b14.el7_4.x86_64/jre/lib/ext:/usr/java/packages/lib/ext
version.JAXP=1.4
version.xalan2x=not-present
#----- END writeEnvironmentReport: Useful properties found: -----

Aside from the amazon version of the Java deployment I’m not seeing a difference, maybe I’m missing something or going down the wrong path?

Here’s the full error message:

Aug 15, 2018 7:26:41 PM org.apache.fop.apps.FopFactoryConfigurator configure
INFO: Default page-height set to: 11in
Aug 15, 2018 7:26:41 PM org.apache.fop.apps.FopFactoryConfigurator configure
INFO: Default page-width set to: 8.26in
ERROR:  'Syntax error in 'null'.'
FATAL ERROR:  'file:/var/www/html/file.xsl: line 349: Required attribute 'select' is missing.'
Aug 15, 2018 7:26:41 PM FOP startFOP
SEVERE: Exception
org.apache.fop.apps.FOPException: file:/var/www/html/file.xsl: line 349: Required attribute 'select' is missing.
javax.xml.transform.TransformerConfigurationException: file:/var/www/html/file.xsl: line 349: Required attribute 'select' is missing.
    at org.apache.fop.cli.InputHandler.transformTo(InputHandler.java:303)
    at org.apache.fop.cli.InputHandler.renderTo(InputHandler.java:130)
    at org.apache.fop.cli.Main.startFOP(Main.java:177)
    at org.apache.fop.cli.Main.main(Main.java:207)
Caused by: javax.xml.transform.TransformerConfigurationException: file:/var/www/html/file.xsl: line 349: Required attribute 'select' is missing.
    at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:990)
    at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTransformer(TransformerFactoryImpl.java:761)
    at org.apache.fop.cli.InputHandler.transformTo(InputHandler.java:281)
    ... 3 more

---------

javax.xml.transform.TransformerConfigurationException: file:/var/www/html/file.xsl: line 349: Required attribute 'select' is missing.
    at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:990)
    at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTransformer(TransformerFactoryImpl.java:761)
    at org.apache.fop.cli.InputHandler.transformTo(InputHandler.java:281)
    at org.apache.fop.cli.InputHandler.renderTo(InputHandler.java:130)
    at org.apache.fop.cli.Main.startFOP(Main.java:177)
    at org.apache.fop.cli.Main.main(Main.java:207)
Answers: