Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 22nd, 2006, 01:12 PM
Registered User
 
Join Date: Jan 2006
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default html option value assigned to xsl:variable

Hi all,

Could any body give me some advice on my problem.

I have a form with a text box which data can be entered and an option box with a list of options to select.
There is also a check box and if the user selects the check box, what ever value is in the option box is posted to the database but if the checkbox is not checked, what ever value is in the textbox is posted to the DB. This could work if I could find a way to what ever value is in the option box into an xsl:variable when the form is posted.

Below is the code that I thought would complete this action but it does not.

<xsl:template name="check">

<form method="POST" action="****.xsql">


<xsl:variable name="op_value">
<xsl:value-of select="type[@option='module']" />
</xsl:xsl:variable>

<input type="text" name="mod" value="{ROWSET/ROW/Module/text()}" size="15" />
<select name="module"><xsl:apply-templates select="ROWSET/ROW/MODULEID" /> </select>
<input type="checkbox" name="check" value="y"/>
</form>


<xsl:value-of select="$op_value" />

</xsl:template>


<xsl:template match="MODULEID">
<option value="{../MODULEID}">
<xsl:value-of select="../MODULE_TYPE" />
</option>

</xsl:template>

 
Old February 22nd, 2006, 01:57 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

You're confused about the relationship of XSLT to HTML. Your XSLT stylesheet generates the HTML page and then finishes execution. Then the browser displays the generated page. By the time the user enters values in the textbox, XSLT has done its job and gone home for tea.

You can fire off another transformation from Javascript in response to user input, but it's not clear that this is the right solution to your problem.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old February 23rd, 2006, 02:27 PM
Registered User
 
Join Date: Jan 2006
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for the input, your right in what you say. The way I got around this was to write procedures in pl/sql. It now works so all is good for now!

Thanks again!








Similar Threads
Thread Thread Starter Forum Replies Last Post
need help putting xsl:value-of in select option eruditionist XSLT 2 September 25th, 2008 08:27 AM
ASSIGNING A JAVA SCRIPT VARIABLE TO A XSL VARIABLE SOMANATHAN10 XSLT 1 February 21st, 2007 04:26 AM
xsl:variable holding name of an xsl:param perissos XSLT 0 December 5th, 2006 07:09 AM
The difference between xsl:variable and xsl:param NEO1976 XML 2 July 24th, 2006 06:05 AM
variable used before it has been assigned a value BenCh BOOK: ASP.NET Website Programming Problem-Design-Solution 1 February 10th, 2006 02:03 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.