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

RE: [xsl] Trouble Populating
inputs in Server-Side XSL


Subject: RE: [xsl] Trouble Populating <form> inputs in Server-Side XSL
From: "Chris Bayes" <chris@xxxxxxxxxxx>
Date: Tue, 13 Nov 2001 20:53:24 -0000

Jibran,
You want 
<input type="hidden" name="LastName">
  <xsl:attribute name="value"><xsl:value-of select="name-last"
/></xsl:attribute>
</input>
Or
<input type="hidden" name="LastName" value="{name-last}" />

Ciao Chris

XML/XSL Portal
http://www.bayes.co.uk/xml


> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx 
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of 
> Jibran Bisharat
> Sent: 13 November 2001 20:30
> To: XSL-List@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] Trouble Populating <form> inputs in Server-Side 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
> 
> 


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



Current Thread
Keywords
xsl