[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Assign the xsl:copy-of output to the value attribute o

Subject: 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
xsl assign
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 &lt; 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 &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>
        
<name>Bugs &lt; 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 &lt; 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 &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="

        Bugs < Bunny

        03/21/1970

        31

        4895 Wabbit Hole Road

        865-111-1111

    " onclick="msg(value);">
ALL Copy: 
<programmer>
        
<name>Bugs &lt; 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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.