This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: Javascript : from xsl to xml
- To: <xsl-list at mulberrytech dot com>
- Subject: RE: Javascript : from xsl to xml
- From: "Chris Bayes" <Chris at Bayes dot co dot uk>
- Date: Thu, 3 Aug 2000 19:54:22 +0100
- Reply-To: xsl-list at mulberrytech dot com
Michel
>I am working on my first XML/XSL project : an encyclopedia for my students.
>
>I have finally learned to use Javascript in my xsl page, linking
>the script
>to a button which is placed in my xsl page (within the Body tags).
>
>Now, I need something more. I am asking here, after going through alot of
>previous messages of this list (which were indeed very helpfull
>up to now).
>
>1. Given this XML element :
><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 ');
>}
>]]>
></script>
Change to
<script language="JavaScript">
<![CDATA[function image(url){
window.open(url);
}
]]>
</script>
>
>3. THEN, given This part in the BODY of my xsl :
>
><TR>
><xsl:apply-templates select="ROOT/SEE_PICTURE"/>
></TR>
>
>4. And finally this in the transformation section on my xsl :
>
><xsl:template match="SEE_PICTURE">
> <TR><xsl:apply-templates /></TR>
></xsl:template>
>
Not sure what this is doing.
><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>
><xsl:apply-templates/>
></a>
></xsl:template>
>
Change it to
<xsl:template match="IMAGE">
<img src="../../../a_icones/oeil2.jpg" width="50" height="25">
<xsl:attribute name="href">
<xsl:value-of select="@href"/>
</xsl:attribute>
</img>
<xsl:apply-templates/>
</xsl:template>
Put a style="cursor:hand" on the img tag if you like.
Hope this helps
Ciao Chris
>
>When I pass the cursor over the button, in IE5, I can see that
>it's calling
>the proper image from the xml element. When I click, a window opens, but
>naturally without the image.
>
>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.
>
>I do hope that I was clear enough. BTW, my approach might as well be
>totally... incorrect....
>
>Thanks for your attention and help.
>
>Michel Guay
>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list