View Single Post
  #1 (permalink)  
Old January 22nd, 2007, 12:58 AM
DrGonzo DrGonzo is offline
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="">
<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