는 다음과 같이 입력 XML 문서를 감안할 때 :변환 '임베디드'XSLT에서 CDATA 출력에 XML의 문서는 (1.0)
<?xml version="1.0" encoding="utf-8"?>
<title> This contains an 'embedded' HTML document </title>
<document>
<html>
<head><title>HTML DOC</title></head>
<body>
Hello World
</body>
</html>
</document>
</root>
내가 그 '내부'HTML 문서를 추출 할 수있는 방법; CDATA로 렌더링하고 출력 문서에 포함 시키시겠습니까?
따라서 출력 문서는 HTML 문서가됩니다. 이 요소에는 요소를 텍스트로 보여주는 텍스트 상자가 있습니다 (내부 문서의 '소스보기'를 표시 할 것입니다).
나는 이것을 시도 :
<xsl:template match="document">
<xsl:value-of select="*"/>
</xsl:template>
그러나 이것은 단지 텍스트 노드를 렌더링합니다.
나는이 시도 :
<xsl:template match="document">
<![CDATA[
<xsl:value-of select="*"/>
]]>
</xsl:template>
을하지만 실제 XSLT를 탈출 내가 얻을 :
<xsl:output method="xml" indent="yes" cdata-section-elements="document"/>
[...]
<xsl:template match="document">
<document>
<xsl:value-of select="*"/>
</document>
</xsl:template>
이것은 CDATA 삽입 않습니다
<xsl:value-of select="*"/>
나는 이것을 시도 섹션에 있지만 출력에는 여전히 텍스트 (제거 된 요소) 만 포함됩니다.
<?xml version="1.0" encoding="UTF-8"?>
<html>
<head>
<title>My doc</title>
</head>
<body>
<h1>Title: This contains an 'embedded' HTML document </h1>
<document><![CDATA[
HTML DOC
Hello World
]]></document>
</body>
</html>
당신이 보여줄 수 귀하의 예상 출력 :
xsl:output
에서cdata-section-elements
속성을 삭제하고 함께document
요소에 대한 템플릿을 대체? –