[xsl] String to XML inside an XSLT

Subject: [xsl] String to XML inside an XSLT
From: Josh Twist <jtwist@xxxxxxxxxxxxxxx>
Date: Wed, 1 May 2002 16:34:15 +0100
This is a bit of a funny one... 
I have, for example, the following XML (muchos simplified) 


This is a little unfortunate but unavoidable as the data is a string and the
xml object builder can't tell the difference between a normal string and one
that should be real XML. Only the XSLT knows this (long story). 

What I need to do is parse this in XSLT as normal and access the XML and
it's values, children, attributes etc stored in the string. For example the
Xpath might read "/nodes/node/childnode" I've tried putting it in variables
with and without output-escaping disabled and so on without success:


<xsl:variable name="myStringXML"> 
	<xsl:value-of select="/nodes/node"/> 

<xsl:for-each select="$myStringXML/childnode"> <!-- Errors here - says
$myStringXML does not evaluate to a node set -->
	<xsl:value-of select="."/> 

Anybody know of a way to do this? Even thought the <xsl:value-of
select="/nodes/node"/> returns the value without the &lt;s etc it's still a
string. What I need is somekind of xml() function that turns a string into a
real nodeset. 

We're using MSXML3. Any help would be greatly appreciated.


The information in this e-mail and any attachment(s) is confidential and may be legally privileged. This e-mail is intended solely for the addressee. If you are not the addressee, dissemination, copying or other use of this e-mail or any of its content is strictly prohibited and may be unlawful. If you are not the intended recipient please inform the sender immediately and destroy the e-mail and any copies. E-mails and unencrypted attachments are scanned for all known viruses. Always scan e-mail attachments for viruses before opening them. All liability for viruses is excluded to the fullest extent permitted by law. Any views expressed in this message are those of the individual sender.

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Current Thread