Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 8th, 2007, 04:34 AM
Authorized User
 
Join Date: Sep 2006
Posts: 92
Thanks: 0
Thanked 0 Times in 0 Posts
Default Explanatory pop-ups / second window ...

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!

 
Old January 8th, 2007, 05:19 AM
Authorized User
 
Join Date: Sep 2006
Posts: 92
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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

 
Old January 8th, 2007, 05:47 AM
Authorized User
 
Join Date: Sep 2006
Posts: 92
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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.

 
Old January 8th, 2007, 06:10 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

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
 
Old January 8th, 2007, 08:53 AM
Authorized User
 
Join Date: Sep 2006
Posts: 92
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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.

 
Old January 8th, 2007, 09:05 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Use attribute value templates:
Code:
<td ALIGN="RIGHT" class="head" title="{ref_explan/@EXPLTEXT}">MyColumnTitle</td>
or:
Code:
]<td ALIGN="RIGHT" class="head" title="{$expr1}">MyColumnTitle</td>
if you prefer.

--

Joe (Microsoft MVP - XML)
 
Old January 8th, 2007, 09:12 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

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





Similar Threads
Thread Thread Starter Forum Replies Last Post
Balloon pop-ups Cyber Shiva Javascript How-To 1 June 18th, 2008 01:08 PM
Newbie Question RE Image pop ups Nostromo77 ASP.NET 2.0 Basics 0 December 10th, 2006 07:31 PM
open multiple pop-ups aspenthu ASP.NET 1.0 and 1.1 Professional 1 May 20th, 2006 04:02 AM
getting all pop-ups nerssi Javascript 3 March 7th, 2006 01:22 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.