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 22nd, 2007, 12:58 AM
Registered User
Join Date: Jan 2007
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
Old January 22nd, 2007, 05:14 AM
joefawcett's Avatar
Wrox Author
Join Date: Jun 2003
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)

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

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