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

Re: javascript in XSLT

Subject: Re: javascript in XSLT
From: Greg Faron <gfaron@xxxxxxxxxxxxxxxxxx>
Date: Mon, 29 Apr 2002 16:27:45 -0600
xslt checkbox javascript
At 03:57 PM 4/29/2002, you wrote:
<xsl:template match="Results">
  <html>
    <head>
      <title>Search Results </title>
    </head>
    <xsl:call-template name="markRecords" />

The JavaScript should really go between the <head> and </head> tags. Move the call-template up one line.


    <body>
      <xsl:apply-templates select="result" />
    </body>
  </html>
</xsl:template>

I assume (you provided no XML data, but I gather from your comments) that there are 5 "result" elements in your XML. If this assumption is incorrect, this means that there will be several <form name="results" ...> in your output. This is incorrect for your purpose, as the name document.results would not be unique. It seems to be the case though, since you say that document.result.length is 5, when document.result.marks.length should have the value 5.


I recommend you alter the templates to output only one <form> element, and a single checkbox for each result (if I'm assuming your data correctly). This would look like the following (I also changed your onclick attribute slightly):

<xsl:template match="Results">
<html>
<head>
<title>Search Results</title>
<xsl:call-template name="markRecords" />
</head>
<body>
<form name="results">
<xsl:apply-templates select="result" />
</form>
</body>
</html>
</xsl:template>
<xsl:template match="result">
<xsl:variable name="key" select="Key" />
<input name="marks" type="checkbox" onclick="saveme('{$key}', this.checked);" />
<br />
</xsl:template>



Greg Faron Integre Technical Publishing Co.



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.