Reputation: 303
I have a XSL that transforms one format of XML into another. In input XML I have a node with following value - which is actually a XML string if we replace < with < (less than) for e.g.
<otherInfo>&lt;Paragraph&gt;&lt;Title&gt;&lt;!CDATA[Pour les nuits du 2012-10-01 - 2012-10-30]]&gt;&lt;/Title&gt;&lt;Text&gt;&lt;![CDATA[TAXES INCLUSES.]]&gt;&lt;/Text&gt;&lt;/Paragraph&gt;</otherInfo>
I want to have the content of otherInfo as a XML node in output XML.
if I do xsl:valueof select="otherInfo", I do not get it as a XML node - it is output just as text. How can I make XSL output the content of otherInfo as XML node ?
Upvotes: 2
Views: 307
Reputation:
If I understand you question correctly...
You could try something like this (code not tested)
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:exslt="http://exslt.org/common" version="1.0">
<xsl:template match="*">
<xsl:variable name="xml-string">
<Paragraph>
<Title>
<!CDATA[Pour les nuits du 2012-10-01 - 2012-10-30]]>
</Title>
<Text>
<![CDATA[TAXES INCLUSES.]]>
</Text>
</Paragraph>
</xsl:variable>
<xsl:variable name="xmlnode" select="exslt:node-set($xml-string)"/>
Title is <xsl:value-of select="$xmlnode//Title"/>
</xsl:template>
Upvotes: 0
Reputation: 243459
You either need to implement an XML parser written in XSLT, call an extension function, or wait for XSLT 3.0 where there may be a standard parse-xml()
function.
Upvotes: 2