【发布时间】:2018-03-22 05:51:46
【问题描述】:
我对 Saxon 和 WildFly 10.0.0.Final 有疑问。我写了一些 XSLT,它们在我运行单元测试时可以正常工作,但是当我在 Wildfly 上运行相同的代码时遇到了问题。
在我的 pom.xml 我有这样的依赖:
<dependency>
<groupId>net.sf.saxon</groupId>
<artifactId>Saxon-HE</artifactId>
<version>9.8.0-4</version>
</dependency>
我尝试了几个版本的 Saxon,甚至将它换成 Xalan,但我仍然遇到同样的问题。它适用于单元测试,但不适用于 Wildfly。问题是“Wildfly 案例”只是忽略了 XSLT 的某些部分。例如这部分被忽略:
<xsl:for-each select="$var33_Tracking/ns0:PartyIdentification/ns0:Location">
<xsl:variable name="var13_LatLong" as="node()" select="ns0:LatLong"/>
<xsl:variable name="var12_cur_as_string" as="xs:string" select="fn:string($var13_LatLong)"/>
<xsl:variable name="var14_result" as="xs:string?">
<xsl:choose>
<xsl:when test="(fn:string(fn:string-length($var12_cur_as_string)) > '0')">
<xsl:sequence select="$var12_cur_as_string"/>
</xsl:when>
<xsl:otherwise>
<xsl:for-each select="ns0:GeoLoc">
<xsl:sequence select="fn:string(.)"/>
</xsl:for-each>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:for-each select="$var14_result">
<LatitudinalHemisphere>
<xsl:choose>
<xsl:when test="(fn:substring-before(., ',') < '0')">
<xsl:sequence select="'S'"/>
</xsl:when>
<xsl:otherwise>
<xsl:sequence select="'N'"/>
</xsl:otherwise>
</xsl:choose>
</LatitudinalHemisphere>
</xsl:for-each>
</xsl:for-each>
它看起来像一些功能:
fn:string-length 或 fn:substring-before 可能会导致此问题,但我无法弄清楚如何解决该问题。有什么想法或提示吗?
【问题讨论】:
-
如果这里有人甚至可以在没有任何关于您如何尝试在 Wildfly 中使用受影响的 XSLT 的信息的情况下开始回答,我会感到惊讶。一般来说,“一些信息”应该是minimal reproducible example。我承认这对于部署在应用程序服务器中的东西来说可能很困难,但你当然可以提供更多的上下文和更少的繁琐。