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 December 6th, 2005, 09:05 AM
Registered User
 
Join Date: Dec 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default An XSL onmouseover problem

Hi there,

I am having a problem creating an onmouseover dynamically using XSL. Please be gentle with me, I suspect this may be a newbie being foolish!

Where ever I use {} notation in my XSL the resulting HTML is broken on to three lines, this isn't a problem with HTML, but now I need to include an onmouseover on an image with an XSL variable as a parameter and I am gettting Unterminated String Literal errors. Snippet of code below along with the snippet of resulting HTML, can supply entire code, but suspect an expert will be able to tell me how stupid I'm being!!

Code:
<td valign="middle">
<div align="center">
<img src="../uploadeddata/{../Product[position()=$p+$h]/MainImage}" alt="{../Name}" align="middle" onMouseover="ddrivetip('{../Product[position()=$p]/MainImage}')"
onMouseout="hideddrivetip()"/>
</div>
</td>
------ Result ------------
<td valign="middle"><div align="center"><img src="../uploadeddata/
TG242A.jpg
        " alt="" align="middle" onMouseover="ddrivetip('
TG476A.jpg
        ')" onMouseout="hideddrivetip()"></div></td>
</tr>
<tr>
--------End Result ---------

As you can see the
Code:
onMouseover="ddrivetip('TG476A.jpg')"
needs to be on one line, but it seems the {} are breaking it on to 3 lines.

Any help would be appreciated, have been turning the internet upside down to fix this one!!!

Al

 
Old December 6th, 2005, 10:09 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Try

onMouseover="ddrivetip('{normalize-space(../Product[position()=$p]/MainImage)}')"


Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old December 6th, 2005, 06:03 PM
Registered User
 
Join Date: Dec 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for that Michael, how ever I feel rather foolish! I'm afraid Dreamweaver in it infinite wisdom adds carridge returns et al to XML files if you let it format the file!

I'm off to beat my self with the stupid stick!

Thanks anyway, at leat I have read up on normalize-space now!






Similar Threads
Thread Thread Starter Forum Replies Last Post
onmouseover question??? RinoDM Javascript 3 May 30th, 2008 03:01 AM
onmouseover sstuber BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 0 April 29th, 2008 12:30 PM
onmouseover gilgalbiblewheel HTML Code Clinic 4 February 4th, 2005 08:05 AM
XSL Transform with xsl string NOT xsl file skin XSLT 0 June 16th, 2003 07:30 AM





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