This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

String to XML inside an XSLT


This is a bit of a funny one... 
I have, for example, the following XML (muchos simplified) 

<nodes> 
	<node> 
		&lt;childnode&gt;value&lt;/childnode&gt; 
	</node> 
</nodes> 

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:

XSLT 

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

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

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.

Josh

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]