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

Trouble Populating <form> inputs in Server-Side XSL

Subject: Trouble Populating <form> inputs in Server-Side XSL
From: "Jibran Bisharat" <jibran@xxxxxxxxxxxxxx>
Date: Tue, 13 Nov 2001 13:29:57 -0700
form hidden variable in xsl
The Situation:
    I declare two XMLDOM objects in my asp.  I load the data below into
either of them, then i call the XMLobj.transformNode(XSLobj).  Then i write
it out to the browser.
The Problem:
    I loop through each record in my response outputing the first and last
name in the first column of a table for display.  (i have omitted all other
data so i wouldn't cloud the subject).   I then need to use the first and
last name to populate a form with those two as inputs.   My attempts at
putting an <xsl:value-of> tag inside an <input> tag have failed:
<input type="hidden" name="LastName" value="<xsl:value-of select="name-last"
/>"/>.

i have tried replacing the the [<], [>], and ["] with [&lt;] ,[&gt;], and
[&quot;] (respectively) but that has not worked.

Another possible solution i tried was to put the first and last name in two
different variables as follows:
<xsl:variable name="lastname"><xsl:value-of select="name-last"
/></xsl:variable>
<xsl:variable name="firstname"><xsl:value-of select="name-first"
/></xsl:variable>
I would then access them by "$lastname" and "$firstname".   I can access
those variables only if i am in an <xsl:> tag NOT in an HTML tag (at least I
have had no luck).

This is the first message i have posted to this List - i applogize if i have
made too length of a reqest....  thanks for your time......

************RAWXML***************
<response>
 <record>
   <name-first>JOHN</name-first>
  <name-last>SMITH</name-last>
 </record>
 <record>
  <name-first>JANE</name-first>
  <name-last>DOE</name-last>
 </record>
</response>
**************************************************
***********InternalXSL.XSL CODE********************
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
 <xsl:template match="/">
  <HTML>
   <BODY>
    <xsl:apply-templates select="response"/>
   </BODY>
  </HTML>
 </xsl:template>

 <xsl:template match="response">
  <TABLE border="1" width="100%" bgcolor="ffffa0">
<xsl:for-each select="record">
   <TR>
    <TD>
     <xsl:value-of select="name-last" /><xsl:value-of select="'  '"/>
     <xsl:value-of select="name-first" /><xsl:value-of select="'  '"/>
    </TD>
   </TR>
    <form name="NameForm" action="Results.ASP" method="post">
     <input type="hidden" name="LastName" value="<xsl:value-of
select="name-last" />"/>
     <input type="hidden" name="LastName" value="<xsl:value-of
select="name-first" />"/>
    </form>
  </xsl:for-each>
  </TABLE>
 </xsl:template>
</xsl:stylesheet>
**************************************************

Jibran Bisharat
Web Developer
Merlin Information Services
Email:  jibran@xxxxxxxxxxxxxx


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

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.