RE: XSL, Javascript

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

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