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

RE: XSL, Javascript

Subject: RE: XSL, Javascript
From: "Maulik Modi" <mxmodi@xxxxxxxxxxxxxxx>
Date: Mon, 31 Jul 2000 14:45:07 -0500
xsl javascript

Hi Heather,

Thank you for your response. I did try your suggestion as follows:

<SCRIPT language="Javascript">
      function selbox(the_array_name) {
      var aname= the_array_name;
      if(aname == 'xxx') {
        document.write('<xsl:apply-templates select=".//locationx"/>');
      }
      if(aname == 'yyy') {
      document.write('<xsl:apply-templates select=".//locationy"/>');
      }
      }
      </SCRIPT>

and then called the function selbox in XSL as follows:

<td align="center">
                   <form action="post" name="formAirPort">
                     <select name="listAirPort" size="1" onchange="
selbox(window.document.formAirPort.listAirPort.options[selectedIndex].text);">
                       <xsl:for-each select=".//location">
                         <option>
                           <xsl:attribute name="value">
                              <xsl:value-of select="./@airportcode"/>
                           </xsl:attribute>
                           <xsl:value-of select="./@airportcode"/>
                         </option>
                       </xsl:for-each>
                     </select>
                   </form>
                 </td>

Unfortunately, as you know, the Javascript will start a fresh page with
document.write in this case. The other option is to use embedded Javascript for
the EVENT onchange="". However, in this case, XSL does not like the '<' even in
Javascript.

I have tried using CDATA for both occassions, in <SCRIPT> under <HEAD> and as
embedded. Neither works....

The XSLT I am using is:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

The processor is xalan.

Let me re-iterate the requirement, I may have made it more complicated than it
is...

I have a XML document with bunch of elements and attributes. I want to present
that in TABLE format and I know how to using XSL. Now, I want to give the user a
select drop-down box where they select an attribute of an element and the TABLE
should present that data record in the first row. As soon as user intervention
is required, the first thing comes to mind is Javascript. There may be other
alternatives within XSL...I am not that deep.

Any help would be appreciated.

Thanks.

MAulik



 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.