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 4th, 2006, 08:51 AM
Registered User
Join Date: Jan 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default getting data from XML rendering with XSL

I'm newbie to xml
I have an xml grammer file contain image files, i have to display the contents with an

xsl file.
The issue is when i mouseover the images i need to display the corresponding images from

that xml file which i'm not able to get. I'm giving piece of code of xml and xsl files.Could

u please tell me how can I get that work done

my xml file is like this

<plaintext><solutions name ="infrastructure solutions"

icon="icons_C2/logo_infrastructure.gif" >

  <Product Name="Automation Documentation Home Page" Icon="icons_C2/home/homelogo.gif"/>

  <Product Name=" Infrastructure User Guide" Icon="icons_C2/home/homelogobas.gif"/>

  <Product Name="Product Structure" Icon="icons_C2/home/homelogopst.gif"/>

  <Product Name="Real Time Rendering" Icon="icons_C2/home/homelogort1.gif"/>

<solutions name =" ..............">

XSL code for this is
<xsl:for-each select="Home/solutions">
<td><img src="{@icon}" name="{@name}" onmouseover='<xsl:for-each select="Product"/>
<td><img src="{@Icon}"/></td>

this way or write a javascript function which will do the similar functionality of xsl

transolation(xsl transolation in javascript method is not possible)

<xsl:for-each select="Home/solutions">
<td><img src="{@icon}" name="{@name}" onmouseover='iconVisible()'/> </td>


<script language="Javascript"
function iconVisible()

<xsl:for-each select="Home/solutions/Product">
<td><img src="{@Icon}"/></td>

I need to display all the solution icons on the left handside.
When I mouseover those icons i need to display corresponding product icons.
Similarly on mouseout icons should be hidden.
Thanks in advance.

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

I suspect there are a few basic concepts that you're still struggling with.

Firstly, you use XSLT to transform your XML into HTML. Then the browser displays the HTML. The first thing you need to do is to decide what HTML you want to generate (you might need to do an HTML mockup first, and test it in the browser). Only then can you start writing the XSLT code to generate that HTML.

Secondly, an XSLT stylesheet is always well-formed XML. That makes code like this a nonsense:

<td><img src="{@icon}" name="{@name}" onmouseover='<xsl:for-each select="Product"/>
<td><img src="{@Icon}"/></td>

I'm afraid this code is so far from correct XSLT that I can't imagine for the life of me what you thought it might do.

If you need to compute the value of an attribute in the generated HTML, you can use the "attribute value template" (AVT) notation:

<img src="{xpath-expression}"/>

Michael Kay
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference

Similar Threads
Thread Thread Starter Forum Replies Last Post
XSL file can't find elements in XML data? Mateo1041 XSLT 2 September 18th, 2008 09:37 AM
distinct data from XML using XSL Hughesie78 XSLT 5 November 20th, 2007 10:25 AM
Rendering HTML inside XML through XSL - HELP !!! jilly XSLT 6 May 23rd, 2007 10:36 AM
XML Rendering HelmutArnold Reporting Services 0 November 1st, 2006 11:12 AM
Getting data from xml and xsl files combined hema_latha7 General .NET 0 May 19th, 2006 08:27 AM

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