Reputation: 55
I have been supplied with a XSLT feed by link which belongs to a agency we do work for. The part I am stuck on is displaying the images and making them into links which go to the image in full view.
I have managed to display the image, but because I am cycling through the images, I am then unable to reuse that node as the link. Sorry if this does not make much sense. Here is the code:
<xsl:for-each select="PHOTOS/IMAGEFILENAME">
<xsl:element name="a">
<xsl:attribute name="href">
<xsl:value-of select="IMAGEFILENAME" />
</xsl:attribute>
<xsl:attribute name="target">_blank</xsl:attribute>
<img>
<xsl:attribute name="src"><xsl:value-of select="IMAGEFILENAME" />
<xsl:apply-templates/>
</xsl:attribute>
<xsl:attribute name="width">63px</xsl:attribute>
<xsl:attribute name="cursor">pointer</xsl:attribute>
<xsl:attribute name="border">0</xsl:attribute>
<xsl:attribute name="id"></xsl:attribute>
</img>
</xsl:element>
</xsl:for-each>
And here is the data it is trying to access:
-<PHOTOS>
<IMAGEFILENAME>http://test.co.uk/test1.jpg</IMAGEFILENAME
<IMAGETHUMBFILENAME/>
<IMAGECAPTION>Reception area (Main)</IMAGECAPTION>
<PRINTQUALITYIMAGE>hhttp://test.co.uk/test2.jpg</PRINTQUALITYIMAGE>
<IMAGEFILENAME>http://test.co.uk/test3.jpg</IMAGEFILENAME>
<IMAGETHUMBFILENAME/>
So I need to establish how to use the <IMAGEFILENAME>
as a link. Thanks
Upvotes: 1
Views: 3779
Reputation: 167426
Does
<xsl:for-each select="PHOTOS/IMAGEFILENAME">
<a href="{.}" target="_blank">
<img src="{.}" width="63" border="0"/>
</a>
</xsl:for-each>
do what you want?
Upvotes: 1