This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Javascript : from xsl to xml


Michel Guay wrote:

> I would like to know how to make the method "WINDOW.OPEN" work with a
> variable that would get the information which is stored in the IMAGE
> element of my xml, so putting the image in the opening window. I will have
> 340 different xml pages, one for each expression of the encyclopedia.

[snip]

> <ROOT>
>          <SEE_PICTURE>
>                  <IMAGE href="../gifjpg/a/abydos01.jpg"></IMAGE>
>          </SEE_PICTURE>
> </ROOT>
> 
> 2. I have this Javascritp in my xsl :
> 
> <script language="JavaScript">
> <![CDATA[function image(){
>          window.open('  NOT YET DEFINED ');

I'm not versed in Javascript, but I assume something like:

  function image(imgname) {
    window.open(imgname);
  }

> }
> ]]>
> </script>

[snip]

> <xsl:template match="IMAGE">
> <a>
>          <xsl:attribute name="href">
>                  <xsl:value-of select="@href"/>
>          </xsl:attribute>
> <button
>     name="image"
>     STYLE="BACKGROUND-COLOR:
> #CECEA5;cursor:hand;width:50;height:25;text-align:absmiddle;"
>     onClick="image()"><img src="../../../a_icones/oeil2.jpg" width="50"
> height="25"/>
> </button>

Here, I think you want to use an attribute value template to extract the
href attribute on the image element:

  ... onClick="image('{@href}')" ...

I don't know the HTML/Javscript enough to tell if this will actually
work, but I assume your question is how to get a parameter into the
image() invocation.

> <xsl:apply-templates/>
> </a>
> </xsl:template>

jay


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]