我想通过文档函数从XSLT中的不同Maven POM中提取一些属性。该脚本本身工作正常,但文档函数返回POM的空结果,只要我在项目标签中有xmlns =“http://maven.apache.org/POM/4.0.0”。如果我删除它,一切正常。
任何想法如何使它的工作,而离开它属于xmlns属性或为什么这不适用于该属性?
这才是我的XSLT的相关部分:与
<xsl:template match="abcs">
<xsl:variable name="artifactCoordinate" select="abc"/>
<xsl:choose>
<xsl:when test="document(concat($artifactCoordinate,'-pom.xml'))">
<abc>
<ID><xsl:value-of select="$artifactCoordinate"/></ID>
<xsl:copy-of select="document(concat($artifactCoordinate,'-pom.xml'))/project/properties"/>
</abc>
</xsl:when>
<xsl:otherwise>
<xsl:message terminate="yes">
Transformation failed: POM "<xsl:value-of select="concat($artifactCoordinate,'-pom.xml')"/>" doesn't exist.
</xsl:message>
</xsl:otherwise>
</xsl:choose>
,为了完整性,一个POM提取与 “坏” 的属性:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<!-- ... -->
<properties>
<proalpha.version>[5.2a]</proalpha.version>
<proalpha.openedge.version>[10.1B]</proalpha.openedge.version>
<proalpha.optimierer.version>[1.1]</proalpha.optimierer.version>
<proalpha.sonic.version>[7.6.1]</proalpha.sonic.version>
</properties>
</project>
好问题(+1)。请参阅我的回答,以获取有关该问题的解释以及最常用的解决方案。 :) – 2010-04-29 12:58:04