RE: [xsl] Pass xml values to a javascript function

Subject: RE: [xsl] Pass xml values to a javascript function
From: "Chen Wang" <wangchen01@xxxxxxxxx>
Date: Sat, 8 Sep 2001 10:28:05 -0700
Hi, Ciao,

I tried, but it did not work.  If I put a specific id in the following
toggle function, it works, that means, I correctly make the attribution to
the paragraph, but the code that you provide can not pass the value from xml
<id> element.  Here is the complete toggle code:
<script language="javascript">

 function WM_toggle(id){

   if (document.all){
     if(document.all[id].style.display == 'none'){
       document.all[id].style.display = 'block';
     } else {
      document.all[id].style.display = 'none';
  } else if (document.getElementById){
    if(document.getElementById(id).style.display == 'none'){
      document.getElementById(id).style.display = 'block';
    } else {
      document.getElementById(id).style.display = 'none';

After I added your code, the page generate the following error:
Error:'docoment.all[...].style' is null or not an object.  Please help me on

-----Original Message-----
From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
[mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Chris Bayes
Sent: Friday, September 07, 2001 10:58 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE: [xsl] Pass xml values to a javascript function

<a href="#" onclick="toggle('{id}')><xsl:value-of

Ciao Chris

XML/XSL Portal

> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Chen Wang
> Sent: 08 September 2001 06:38
> To: XSL-List@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] Pass xml values to a javascript function
> In xsl file, there is a javascript,
> function toggle(id) {
>    codes here
>   }
> which is used to change the display status of a
> paragraph.  A link will be used to invoke the
> function, like this:
> <a href="#"
> onclick="toggle('a_paragraph_id')><xsl:value-of
> select="paragraphname"></a>
> And here is the paragraph should be changed:
> <p style="display:none"><xsl:attribute
> name="id"><xsl:value-of
> select="paragraphid"/></xsl:attribute>paragraph
> here</p>
> As you may know, in xml there is an element like this:
> <paragraphid>idnumer</paragraphid>.  My question is: how to
> pass idnumber to 'a_paragraph_id'.
> The idea for this xsl is to generate a list of links
> based on the paragraphs in a xml.  And each link can
> toggle the correspondent paragraph.  Thanks,...chen
> __________________________________________________
> Do You Yahoo!?
> Get email alerts & NEW webcam video instant messaging with
> Yahoo! Messenger
>  XSL-List info and archive:

 XSL-List info and archive:

Do You Yahoo!?
Get your free address at

 XSL-List info and archive:

Current Thread