View Full Version : Hyperlinks in XSL Style Sheet
data_graphics
December 20th, 2004, 01:51 PM
I want to format basic hyperlinks using XSL, but I can't seem to locate how to do it. I'd like to populate a table with web addresses
For example, using just the simple XML data:
<item>
<title><![CDATA[Kirupa Forums]]></title>
<link>http://www.kirupaforum.com </link>
</item>
How would I design an XSL style sheet for creating a clickable hyperlink for "Kirupa Forums"? I checked W3Schools, but they do not go into this in their tutorials that I could find.
Bluedackers
December 22nd, 2004, 02:58 AM
On the W3Schools web site I found this:
<?xml version="1.0" encoding="ISO-8859-1"?>
<catalog>
<cd>
<title>Empire Burlesque</title>
<artist>Bob Dylan</artist>
<country>USA</country>
<company>Columbia</company>
<price>10.90</price>
<year>1985</year>
</cd>
.
.
.
</catalog>
And the accompanying XSLT sheet:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="<A href="http://www.w3.org/1999/XSL/Transform"><xsl:template">http://www.w3.org/1999/XSL/Transform"><xsl:template match="/">
<html>
<body>
<h2>My CD Collection</h2>
<table border="1">
<tr bgcolor="#9acd32">
<th align="left">Title</th>
<th align="left">Artist</th>
</tr>
<xsl:for-each select="catalog/cd">
<tr>
<td><xsl:value-of select="title" /></td>
<td><xsl:value-of select="artist" /></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template></xsl:stylesheet>
Also, check http://www.w3schools.com/xsl/xsl_client.asp
Rgds,
Maurits
data_graphics
December 22nd, 2004, 11:17 AM
Right, they tell you how to format plain text, but not how to create a *clickable* (A HREF) hyperlink.
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.