0
XSLT가 있는데 특정 노드를 제외하고 특정 노드 아래의 모든 요소를 복사하려고합니다. 내가이 노드를 무시하는 이유는 노드가 xml에 존재하는지 확인해야하기 때문이며, 기본값이 아닌 경우 &입니다. 여기에 코드 snipette는XSLT가 모든 노드와 일치하고 특정 노드를 무시합니다.
나는 그래서 내가 특별히 여기
<xsl:template match="*" mode="copyexcludingDL">
<xsl:copy>
<xsl:apply-templates select="@*|node()[not(self::DriversLicense)]"/>
</xsl:copy>
</xsl:template>
이있는 특정 노드에 대해이 작업을 사용할 수있는 모드를 포함 XSLT &에 몇 가지 다른 템플릿이 작동하지 않는 것 내가 &을 한 것입니다 노드 & 논리
<xsl:for-each select="Vehicle">
<xsl:apply-templates mode="copyexcludingDL" select=".">
<xsl:choose>
<xsl:when test="DriversLicense">
<xsl:apply-templates mode="copy" select="DriversLicense" />
</xsl:when>
<xsl:otherwise>
<xsl:element name="DriversLicense">
<xsl:text>None</xsl:text>
</xsl:element>
</xsl:otherwise>
</xsl:choose>
</xsl:apply-templates>
</xsl:for-each>
입력 XML을 질문에 추가하십시오. –