Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating a hyperlink in XML/XSL

Status
Not open for further replies.

snakehips2000

Programmer
Nov 10, 2003
95
GB
Could someone please give me a very example of the syntax for displaying a hyperlink in HTML for a URL value stored in an XML/XSL document.

I've looked for answers on this forum without success - maybe the answer's so obvious!

Thanks.
 
A more effective answer might be obtained if you provided an (abbreviated) XML document, the desired output HTML document, and your initial attempt at an XSL document that accomplishes the translation. Then the rest of us might see where the confusion arises.

Tom Morrison
 
OK, at its simplest level, I'm trying to obtain output in an HTML page showing a table of values (2 rows x 3 columns).

The "photo" node in the XML document needs to have a URL stored within it for each of the two rows such that when the user clicks on the text "View Image" on the HTML page, it opens the relevant image in a new window. I'm making the (possibly wrong) assumption that I need to employ XSL to achieve this.

Hope this helps someone answer my question.

XML document
============
<?xml version="1.0" encoding="iso-8859-1"?>
<?xml-stylesheet type="text/xsl" href="../html/XSLtest.xsl"?>
<catalogue>
<bcp>
<photo>View Image</photo>
<itemcode>Item 3</itemcode>
<xname>Tent Pins</xname>

</bcp>
<bcp>
<photo>View Image</photo>
<itemcode>Item 3</itemcode>
<xname>Tent Pins</xname>
</bcp>
</catalogue>

XSL document
============
<xsl:stylesheet version = '1.0'
xmlns:xsl='
<xsl:template match="bcp">
<table border="1">
<tr>
<td><xsl:value-of select="itemcode"/></td>
<td><!-- this is where I'm stuck! --></td>
<td><xsl:value-of select="xname"/></td>
</tr>
</table>
</xsl:template>
 
><td><!-- this is where I'm stuck! --></td>
[tt]<td><a href="{photo}"><xsl:value-of select="photo" /></a></td>[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top