This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Trouble Populating <form> inputs in Server-Side XSL
- To: <XSL-List at lists dot mulberrytech dot com>
- Subject: [xsl] Trouble Populating <form> inputs in Server-Side XSL
- From: "Jibran Bisharat" <jibran at merlindata dot com>
- Date: Tue, 13 Nov 2001 13:29:57 -0700
- Reply-to: xsl-list at lists dot mulberrytech dot com
[Get raw message]
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 [<] ,[>], and
["] (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@merlindata.com
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list