RE: [xsl] Generating an overlib popup with XSL

Subject: RE: [xsl] Generating an overlib popup with XSL
From: cknell@xxxxxxxxxx
Date: Wed, 31 Aug 2005 11:12:02 -0400
The stylesheet you provided doesn't have anything that outputs a "onmouseover" event handler as you described in the body of your message. Where exactly do you want that to appear?
--
Charles Knell
cknell@xxxxxxxxxx - email



-----Original Message-----
From:     Achim Stdbler <achim@xxxxxxxxxxxx>
Sent:     Wed, 31 Aug 2005 16:22:14 +0200
To:       xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject:  [xsl] Generating an overlib popup with XSL

Hello List :)

I'm trying to generate a popup window using overlib.

basic outline:
<a onmouseover="overlib('*html source here*',*OPTIONS*);' onmouseout='return nd(); href="bla.html">...</a>


will show a popup window with the given source (i'd like to have a <div>...</div> there).
My problem: i need to generate the attribute onmouseover from several elements using xsl:for-each. AFAIk this is not possible in XSL. i have found a thread in the overlib forum that suggests using javascript variables for this task, but this seems very clumsy to me. is there no other way to achieve this?


Thanks,

Achim

PS: using xsltproc from libxml 20620 with XSLT 1.0 support.

xml (looks familiar for WoW junkies *g*):
<?xml version="1.0" encoding="UTF-8"?>
<raid>
<loot>
<item count="1" id="10362:0:1205:1846414464" mob="" name="Ornate Shield of the Bear" player="Merkles" points="" rarity="ff1eff00" type="Special-Shield">
<tooltip>
<line>
<text align="left">Ornate Shield of the Bear</text>
</line>
<line>
<text align="left">Binds when equipped</text>
</line>
<line>
<text align="right">Shield</text>
<text align="left">Off Hand</text>
</line>
<line>
<text align="left">1776 Armor</text>
</line>
<line>
<text align="left">32 Block</text>
</line>
<line>
<text align="left">+9 Stamina</text>
</line>
<line>
<text align="left">+10 Strength</text>
</line>
<line>
<text align="left">Requires Level 53</text>
</line>
</tooltip>
</item>
</loot>
</raid


xsl:
<?xml version="1.0" encoding="utf8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="1.0">
<xsl:output method="html" version="1.0" encoding="iso-8859-1" indent="yes"/>
<xsl:template match="raid">
<xsl:for-each select="loot/item">
<xsl:sort select="@name"/>
<xsl:element name="tr">
<xsl:attribute name="class">row<xsl:value-of select="position() mod 2"/>
</xsl:attribute>
<td>
<a href="test.html">
<!--** how to get this block into an attribute? ** -->
<!--<xsl:attribute name="onmouseover"
escapetext="true">-->
<xsl:text>overlib("</xsl:text>
<xsl:for-each select="tooltip/line">
<xsl:for-each select="text">
<xsl:element name="div">
<xsl:attribute
name="class"><xsl:value-of select="@align"/></xsl:attribute>
<xsl:value-of
select="."/>
</xsl:element>
</xsl:for-each><br />
</xsl:for-each>
<xsl:text>",FOLLOWMOUSE);</xsl:text>
<!--</xsl:attribute>-->
<!--<xsl:attribute name="onmouseout">return
nd();</xsl:attribute>-->
<span><xsl:value-of select="@name"/></span>
</a>
</td>
<td><xsl:value-of select="@player"/></td>
<td><xsl:value-of select="@count"/></td>
<xsl:choose>
<xsl:when test="@points != ''">
<td><xsl:value-of select="@points"/></td>
</xsl:when>
<xsl:otherwise>
<td>0</td>
</xsl:otherwise>
</xsl:choose>
</xsl:element>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>


Current Thread