XML 문서에서 변환을 시도하고 있습니다.공백 xmlns = ""가져 오기에서의 특성
<StructureA xmlns="http://...">
StructureA & :
<xsl:template match="/">
<xsl:choose>
<xsl:when test="/databean/data[@id='pkhfeed']/value/text()='200'">
<xsl:call-template name="StructureA">
<xsl:with-param name="structure" select="//databean" />
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="StructureB">
<xsl:with-param name="structure" select="//databean" />
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
StructureA 또는 StructureB가 다음 자신의 네임 스페이스와 schemaLocations로 만들어집니다 내 XML 변환은 특정 요소의 값에 따라 기본 요소의 두 가지 유형이 발생할 수 있습니다 B는 몇 가지 공통 요소를 공유하므로 두 구조에 템플릿이 포함 된 별도의 파일 "xmlcommon.xslt"에 정의되어 있습니다. 이 xmlcommon 파일에는 StructureA 또는 StructureB에 정의 된 네임 스페이스에서 사용할 수 있도록 정의 된 기본 네임 스페이스가 없습니다. 내 변환을 실행할 때, 어떤 템플릿 빈의 xmlns의 일반적인 파일 결과에서 가져온 속성 : 유효성을 검사 할 때, 빈 공간은 다음 대신 올바른 부모 중 하나가 사용됩니다
<StructureA xmlns="http://...">
<SharedElement xmlns="">Something</SharedElement>
</StructureA>
. 누구나 공통 파일에서 빈 xmlns 속성을 추가하지 않고 템플릿을 중지 할 수있는 방법을 알고 있습니까?
다음은 일반적인 파일에서 코드 조각입니다 :
<xsl:stylesheet version="1.0" xmlns:fn="http://www.w3.org/2005/02/xpath-functions" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template name="ControlledListStructure">
<xsl:param name="xmlElem" />
<xsl:param name="structure" />
<xsl:element name="{$xmlElem}">
<!-- Blah blah blah -->
</xsl:element>
</xsl:template>
</xsl:stylesheet>
좋은 설명, Evan. 추가 할 것이 아무것도 없습니다. +1. 에 오신 것을 환영합니다. –
감사합니다. 그것은 큰 도움이됩니다 :) 그리고 추가 정보를 주셔서 감사합니다. XSLT를 자주 만지지는 않기 때문에 더 나은 방법으로 일을하는 것이 좋다. –