[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
[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: [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: Aasia Haroon <aasia.h@xxxxxxxxx> Date: Sun, 30 Jan 2005 07:01:29 -0800 |
Hello All, I would like to assign the xsl:copy-of output to the value of xsl:element (checkbox). I need it for further processing of the node on the server. Could you please guide me on the same. E.g. XSL <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xhtml="http://www.w3.org/1999/xhtml" version="1.0"> <xsl:output method="html" version="4.0" /> <xsl:template match="/"> <html> <body> <script language="Javascript"> function msg(val) { alert(val); } </script> <form onsubmit="return false;" name="f"> <xsl:for-each select="devguru_staff/programmer"> <div> NAME: <xsl:value-of select="name" /> <br /> DOB: <xsl:value-of select="dob" /> <br /> AGE: <xsl:value-of select="age" /> <br /> ADDRESS: <xsl:value-of select="address" /> <br /> PHONE: <xsl:value-of select="phone" /> <br /> <xsl:element name="input"> <xsl:attribute name="name">lastEvent</xsl:attribute> <xsl:attribute name="type">checkbox</xsl:attribute> <xsl:attribute name="value"><xsl:copy-of select="."/></xsl:attribute> <xsl:attribute name="onclick">msg(value);</xsl:attribute> </xsl:element> ALL Copy: <xsl:copy-of select="."/> <hr /> </div> </xsl:for-each> </form> </body> </html> </xsl:template> </xsl:stylesheet> E.g. XML <?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="dev_output.xsl"?> <devguru_staff> <programmer> <name>Bugs < Bunny</name> <dob>03/21/1970</dob> <age>31</age> <address>4895 Wabbit Hole Road</address> <phone>865-111-1111</phone> </programmer> </devguru_staff> 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 < 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> <name>Bugs < Bunny</name> <dob>03/21/1970</dob> <age>31</age> <address>4895 Wabbit Hole Road</address> <phone>865-111-1111</phone> </programmer>" onclick="msg(value);"> ALL Copy: <programmer> <name>Bugs < Bunny</name> <dob>03/21/1970</dob> <age>31</age> <address>4895 Wabbit Hole Road</address> <phone>865-111-1111</phone> </programmer> <hr> </div> </form> </body> </html> Actual 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 < 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=" Bugs < Bunny 03/21/1970 31 4895 Wabbit Hole Road 865-111-1111 " onclick="msg(value);"> ALL Copy: <programmer> <name>Bugs < Bunny</name> <dob>03/21/1970</dob> <age>31</age> <address>4895 Wabbit Hole Road</address> <phone>865-111-1111</phone> </programmer> <hr> </div> </form> </body> </html> Any help on this would be appreciated. Have also tried with output method set to xml. Regards Aasia
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] XSLT for Extensibility, Dimitre Novatchev | Thread | AW: AW: [xsl] struggling with <xsl:, Huditsch Roman |
Re: [xsl] XSLT for Extensibility, Dimitre Novatchev | Date | AW: AW: [xsl] struggling with <xsl:, Huditsch Roman |
Month |