0

XMLファイルをわずかに異なるXMLファイルに変換するために、この整形式のXSLTファイルがあります。プレーン Java で変換を実行するとセットアップは機能しますが、Google App Engine でコードを実行しようとすると、XSLT ファイルをロードしようとするとクラッシュし、次のエラー メッセージが表示されます。

ERROR:  'null'
FATAL ERROR:  'Could not compile stylesheet'
javax.xml.transform.TransformerConfigurationException: Could not compile stylesheet
    at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTemplates(Unknown Source)
    at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTransformer(Unknown Source)

ジャワ:

(ここで何かがうまくいかない)

    InputStream is = context.getResourceAsStream("/xslt/add_spaces_and_ids.xslt");
    if (is == null) {
        throw new NullPointerException("File could not be found");
    }
    Source xsltSource = new StreamSource(is);
    Transformer transformer = factory.newTransformer(xsltSource);
    return transformer;

XSLT:

(特に何もないはず)

<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:strip-space elements="*"/>
  <xsl:output method="xml" indent="yes"/>
  <xsl:template match="kop">
    <xsl:variable name="kopText">
      <xsl:value-of select="."/>
    </xsl:variable>
    <xsl:variable name="titelText">
      <xsl:value-of select="titel"/>
    </xsl:variable>
    <!-- Add a space -->
    <xsl:text> </xsl:text>
    <xsl:copy>
      <xsl:attribute name="id">
        <xsl:value-of select="generate-id()" />
      </xsl:attribute>
      <xsl:apply-templates select="node() | @*"/>
    </xsl:copy>
  </xsl:template>
  <xsl:template match="node()">
    <xsl:text> </xsl:text>
    <xsl:copy>
      <xsl:apply-templates select="node() | @*"/>
    </xsl:copy>
  </xsl:template>
  <xsl:template match="@*">
    <xsl:copy>
      <xsl:apply-templates select="node() | @*" />
    </xsl:copy>
  </xsl:template>
</xsl:stylesheet>

どうすればこれを修正できますか?

4

1 に答える 1