인사말!XSLT Document 함수는 Maven POM에서 빈 결과를 반환합니다.
문서 기능을 통해 XSLT에서 다른 Maven POM의 일부 속성을 추출하고 싶습니다. 스크립트 자체는 정상적으로 작동하지만 프로젝트 태그에 xmlns = "http://maven.apache.org/POM/4.0.0"이있는 한 문서 함수는 POM에 대해 빈 결과를 반환합니다. 제거하면 모든 것이 잘 작동합니다.
xmlns 속성이 속한 곳에서 떠나는 동안 왜이 기능이 작동하는지, 또는 왜이 기능이 해당 속성에서 작동하지 않는지 생각해보십시오. 완전성에 대한
<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). 문제에 대한 설명과 가장 자주 사용되는 솔루션에 대한 내 대답을 참조하십시오. :) –