, , .
, "STR2XML", . - , . .
, :
<xsl:variable name="text">
<![CDATA[
<div style="color:red;">
<p>hello world</p>
</div>
]]>
</xsl:variable>
<p>
<xsl:value-of select="$text"/>
</p>
<xsl:call-template name="str2xml">
<xsl:with-param name="text" select="$text"/>
</xsl:call-template>
:
<div style="font-weight:bold;"> <p>hello world</p> </div> (non parsed plain text)
But of course, you can also use it to create a variable that can be accessed as node:
<xsl:variable name="text2">
<![CDATA[
<div>hello world</div>
<p>goodbye world</p>
]]>
</xsl:variable>
<xsl:variable name="var1">
<xsl:call-template name="str2xml">
<xsl:with-param name="text" select="$text2"/>
</xsl:call-template>
</xsl:variable>
<xsl:for-each select="xalan:nodeset($var1)/*">
<p>
<xsl:value-of select="concat(name(.),': ',.)"/>
</p>
</xsl:for-each>
Conclusion:
div: hello world
p: good peace
source
share