[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] Assign the xsl:copy-of output to the value attribute of checkbox input xsl:element OR copying a node as a xml string to value of a geckbox


Subject: RE: [xsl] Assign the xsl:copy-of output to the value attribute of checkbox input xsl:element OR copying a node as a xml string to value of a geckbox
From: <Jarno.Elovirta@xxxxxxxxx>
Date: Mon, 31 Jan 2005 10:31:28 +0200

Hi,

snip

> Expected xslt output:
> <html xmlns:xhtml="http://www.w3.org/1999/xhtml">
> <body>
> <script language="Javascript">
> function msg(val)
> {
>   alert(val);
> }
> </script>
> <form name="f" onsubmit="return false;">
> <div>
> NAME: Bugs &lt; Bunny<br>
> DOB: 03/21/1970<br>
> AGE: 31<br>
> ADDRESS: 4895 Wabbit Hole Road<br>
> PHONE: 865-111-1111<br>
> <input name="lastEvent" type="checkbox" value="
> <programmer>

You want to write elements into an attribute value. Why? Why not escaped
markup? This is not well-formed XML and cannot be achived with vanilla XSLT.
Either you output

<input name="lastEvent" type="checkbox" value="
&lt;programmer&gt;
...

by using a XML serializer written in XSLT (e.g.
<http://www.xmlportfolio.com/xml-to-string/>), or if you absolutely need

<input name="lastEvent" type="checkbox" value="
<programmer>
...

Then use the above method in conjunction with a result tree serializer that
doesn't escape the output for that particular element. IIRC, Saxon also has an
extension to use DOE in xsl:attribute.

Cheers,

Jarno - SITD: Venom


Keywords