Subject: Explanatory pop-ups / second window ...
Posted By: asearle Post Date: 1/8/2007 3:34:32 AM
Hallo everyone,

I have a bunch of reports written with XSLT, based on XML data, running client-side (IE 6.0.2 SP2) with some dynamic features controlled by javascript (embedded in the XSLT).  This all works fine and displays the data that I require.

However, I would like to include some explanatory pop-ups so that the user can click on a certain area to get a little pop-up that displays an explanation of the data in that field.

I can include a little javascript procedure to call an HTML file as a pop-up but I would rather do this dynamically based on information contained from the same XML as the actual data (i.e. I would include a little explanatory/meta section in the XML data file).

Here I am not sure how to do this (with in javascript in the XSLT?) so that the pop-up will open without re-writing the main document/display.  Indeed, when the pop-up is closed, the user should return automatically to the item that he/she was viewing before.  Ideally, the pop-up would float above the main document until closed.

If anyone has any tips/examples about how to do this (i.e. handling two documents/displays at one time), that would be a a great help for me.

Many thanks,
Alan Searle.

PS: A happy and successful New Year to you all!

Reply By: asearle Reply Date: 1/8/2007 4:19:03 AM
Or maybe there is a way of adding a kind of 'Tool-Tip' (i.e. kind of floating bubble) that I can trigger with the 'on-mouseover' event?

That might be better than a pop-up (which can be blocked) and could be linked very specficially to the relevant area/field.

I will investigate this and will give feedback to the forum.

Regards,
Alan Searle

Reply By: asearle Reply Date: 1/8/2007 4:47:23 AM
Yes ... found!

I have been fishing around and, yes, I think I've found what I need:

I can add 'TITLE' to a link or title ... e.g. ...

<td ALIGN="RIGHT" class="head" title="This is a floating text">MyColumnTitleText</td>

... and it works like a 'Tool-Tip'.  That's great!

However, I would still be interested to handle two windows from one XSLT?  This probably isn't possible but if anyone has any thoughts, then that would be a great help.

Regards,
Alan.

Reply By: mhkay Reply Date: 1/8/2007 5:10:55 AM
Split the problem into two. First work out what HTML (including any embedded Javascript) you want to generate (produce a mock-up by hand). Then work out how to generate that HTML/Javascript using XSLT.

If you don't know what HTML you want to generate, then this forum isn't the place to find out.

Some XSLT processors allow you include extension functions written in Javascript. But that Javascript can never respond to user events, because it's invoked at transformation time. You can however have Javascript in your HTML page that initiates a new XSLT transformation in response to a user interaction.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
Reply By: asearle Reply Date: 1/8/2007 7:53:21 AM
Hi Michael,

Thanks for your explanation about handling various documents at once.  I will experiment with that:  It will certainly be very helpful!

With my 'ToolTip' idea (using the title attribute), I have found suitable syntax but am having trouble passing the variable.  So far I can retrieve the value that I want with the following ...

<xsl:value-of select="ref_explan/@EXPLTEXT" />

But have had trouble getting it to display as 'Title'.  Here I have tried the following ...

<xsl:variable name="expl1" select="ref_explan/@EXPLTEXT"/>
<td ALIGN="RIGHT" class="head" title="$expl1">MyColumnTitle</td>

(... and several variations of this).

The attribute 'title' seems to demand the inverted commas which, in turn, interfer with my 'select' clause.  And then, when I use a variable such as $expl1, the title displays the name of the variable rather than its content.

I am sure that this is a simple syntax issue and hope that you can give me a little tip to help me on my way.

Regards,
Alan Searle.

Reply By: joefawcett Reply Date: 1/8/2007 8:05:10 AM
Use attribute value templates:
<td ALIGN="RIGHT" class="head" title="{ref_explan/@EXPLTEXT}">MyColumnTitle</td>

or:
]<td ALIGN="RIGHT" class="head" title="{$expr1}">MyColumnTitle</td>
if you prefer.

--

Joe (Microsoft MVP - XML)
Reply By: mhkay Reply Date: 1/8/2007 8:12:37 AM
You want title="{$expl1}" or simply

title="{ref_explan/@EXPLTEXT}"

Look up "attribute value templates" in the index of your favourite XSLT textbook.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference

Go to topic 54515

Return to index page 70
Return to index page 69
Return to index page 68
Return to index page 67
Return to index page 66
Return to index page 65
Return to index page 64
Return to index page 63
Return to index page 62
Return to index page 61