Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XSLT
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 22nd, 2007, 12:58 AM
Registered User
Join Date: Jan 2007
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to DrGonzo
Default Image not displaying properly but I path correct


I am only new to XSLT, only started this morning! I have a XML file containing details of photographs:

<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="Test.xsl"?>
  <Photograph PhotographId="1">
  <Photograph PhotographId="2">

I only store the name of the photograph (in above example 100_2228) rather than the full path of the thumbnail (./Pics/Thumbs/100_2228.jpg) and the full image (./Pics/Full/100_2228.jpg). I only store the name to avoid storing duplicate data as I will eventually be storing thousands of photographs.

My XSL file displays these photographs and is as follows:

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
    <h2>Gallery Test</h2>
      <tr bgcolor="#3ff455">
        <th>Pic Name</th>
      <xsl:for-each select="Photographs/Photograph[@PhotographId &lt; 3]">
        <td><xsl:value-of select="Camera"/></td>
        <td><xsl:value-of select="Name"/></td>
            <xsl:attribute name="src">
              "./Pics/Thumbs/<xsl:value-of select='Name'/>.JPG"

As a test I just returned "./Pics/Thumbs/<xsl:value-of select='Name'/>.JPG" as a string to the screen and the path is correct, it should show an image but all that happens is the box with X in it. If I add an image on a page and set src to the path returned by "./Pics/Thumbs/<xsl:value-of select='Name'/>.JPG" then the image is displayed as it should.

Any suggestions as to why it is not being displayed? There are no errors shown, just no image displayed! Thanks
Reply With Quote
  #2 (permalink)  
Old January 22nd, 2007, 05:14 AM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts

Search for Attribute Value Templates in an XSLT reference, you need something like:
<img src="./Pics/Thumbs/{Name}"/>

Joe (Microsoft MVP - XML)
Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
IE not displaying padding properly :-( lpcrooks CSS Cascading Style Sheets 0 November 17th, 2006 01:08 AM
displaying images in crystal report based on path thas123 Crystal Reports 1 May 24th, 2006 01:47 AM
Help: Pass the image path to another page hoailing22 ASP.NET 1.0 and 1.1 Basics 7 March 13th, 2006 10:19 AM
How to insert path of the image in sql server hoailing22 SQL Server 2000 0 February 28th, 2006 03:32 AM
displaying an image from file stream into an image sanjeet ADO.NET 0 September 23rd, 2005 10:28 AM

All times are GMT -4. The time now is 03:06 PM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.