0
A.xsl은 B.xsl을 가져 오며 A.xsl에서 사용되는 함수를 포함합니다. A.xsl에는 ID 템플릿이 들어 있습니다. B.xsl의 함수는 템플릿 규칙을 변수에 적용해야합니다. 그러나 A.xsl의 ID 템플리트가이를 대체합니다.xsl : apply-imports를 변수에?
내 생각은 B의 변수에 xsl:apply-imports
으로 생각했지만 xsl:apply-templates
과는 달리 select=
변수를 가리키는 방법이 없습니다. 원래 함수는 템플릿 규칙으로 바꿀 수 없습니다. B.xsl을 xsl:include
-ing하지 않고이 작업을 수행 할 수 있습니까?
는 A.xsl :
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:my="http://me"
version="2.0">
<xsl:import href="B.xsl"/>
<xsl:template match="X">
<xsl:sequence select="my:do-stuff(.)"/>
</xsl:template>
<xsl:template match="@*|node()" mode="#all" priority="-1">
<xsl:copy>
<xsl:apply-templates select="@*|node()" mode="#current"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
B.xsl :
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:my="http://me"
version="2.0">
<xsl:template match="X" mode="cleanup">
<clean><xsl:apply-templates/></clean>
</xsl:template>
<xsl:function name="my:do-other-stuff">
<xsl:param name="x" as="element(X)"/>
...
</xsl:function>
<xsl:function name="my:do-stuff">
<xsl:param name="x" as="element(X)"/>
<xsl:variable name="x-updated" select="my:do-other-stuff($x)"/>
<xsl:apply-templates select="$x-updated" mode="cleanup"/>
</xsl:function>
</xsl:stylesheet>