|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: 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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








