Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - Re: Assigning xml string using xsl:copy-of to xml:variable >Thread Next - Re: Assigning xml string using xsl:copy-of to xml:variable Re: Assigning xml string using xsl:copy-of to xml:variableTo: NULL Date: 7/6/2004 9:09:00 AM "Oleg Tkachenko [MVP]" <oleg@NO!SPAM!PLEASEtkachenko.com> wrote in message news:<eJdYHmzYEHA.644@t...>...
> ms wrote:
>
> > I need to retrieve a large portion of the input xml, character-escape
> > the " and ', and pass the string as an argument to a Javascript
> > function in the xsl.
> > I can't see any way of assigning the xml fragment (retrieved using
> > xsl:copy-of) into an xsl:variable (or sending as an xsl:parameter to a
> > template).
>
> <xsl:variable name="var" select="the-expression-you-would-use-in-copy-of"/>
>
> But it's not really clear what you mean. Provide some samples please.
Input XML:
<root>
<a att1="dkjf">
<b att2="dkf">John's</b>
<b att2="dkf">Dave's</b>
</a>
</root>
I need, within the xsl, to send a fragment of the above xml as an
argument to a Javascript funtion:
func('<a att1="dkjf"><b att2="dkf">John's</b><b
att2="dkf">Dave's</b></a>');
The xml string first needs to have the " and ' output escaped. This
will need to be done using xsl so that I have the following instead:
func('<a att1=\"dkjf\"><b att2=\"dkf\">John\'s</b><b
att2=\"dkf\">Dave\'s</b></a>');
The problem I have is how to retrieve the full xml (elements included)
from the source xml.
Using:
<xsl:variable name="var" select="="/root/a"/>
simply produces "John'sDave's".
As does:
<xsl:variable name="var" >
<xsl:copy-of select="/root/a"/>
</xsl:variable>
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
