Hello All,

I've always found good answers here. Thanks in advance for any help.

I've looked around and haven't found a good answer to work with. Maybe I'm using the wrong keywords. If someone can provide the answer, that'd be great.

I have an xml document:

<root>
<product>
<image>bike.jpg</image>
</product>
</root>

The xsl file:

<xsl:stylesheet>
<xsl:template match="/">
<html>
<body>

<xsl:for-each select="root/product"
<table><tr>
<td>
<xsl:element name="img">
<xsl:attribute name="src">
<xsl:value-of select="image"/>
</xsl:attribute>
</xsl:element>
</td>
</tr><table>
</xsl:for-each>

</body>
</html>
</xsl:template>
</xsl:stylesheet>

Let's say bike.jpg is stored at /upload/product/new/ and the xml and xsl file are stored at /content/

My understanding is that the above xsl will render the xml into html as:

<img src="bike.jpg">

What do I use and where do I put the code so that when it renders, it becomes:

<img src="/upload/product/new/bike.jpg">

One solution to this issue is that I can just enter the full path into the <image> tag of the xml. I want to avoid this if possible.

<xsl:value-of select="concat('/upload/product/new/',image)"/>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.