我想在XSLT中獲得此信息。這可能嗎?是否可以在XSLT中將整個源XML作爲CDTA獲取?
源XML
<Parent>
<Child></Child>
<Child></Child>
<Child></Child>
<Child></Child>
</Parent>
輸出XML
<Issue>
<Node1>Something happening here</Node1>
<Node2>Something happening here</Node2>
<Node3><![CDATA[
<Parent>
<Child></Child>
<Child></Child>
<Child></Child>
<Child></Child>
</Parent>
]]>
</Issue>
我想整個輸入XML作爲<Node3>
CDATA這可能嗎?
我的XSLT看起來像下面(摘錄)
<xsl:template match="/">
<xsl:call-template name="Issue"/>
</xsl:template>
<xsl:template name="Issue">
<xsl:call-template name="Node1"/>
<xsl:call-template name="Node2"/>
<xsl:call-template name="Node3"/>
</xsl:template>
....
<xsl:template name="Node3">
<!-- Here as CDATA i want the input xml content-->
</xsl:template>
誰能幫助我解決這個問題?我使用XSLT 1.0
您正在使用哪個XSLT處理器?在XSLT 2.0中,您可以使用'cdata-section-elements =「Node3」',但您提到您使用的是1.0。在那種情況下,我認爲你被困在特定於處理器的擴展中。 – LarsH 2013-04-11 15:29:52
javax.xml.transform.Transformer – KK99 2013-04-11 15:33:23