This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: How to create active hyperlinks from xml file
Your solution works fine.
I am trying to make one stylesheet that I can use for multiple xml files
that contain hyperlinks. The following is as close as I can get. The xml
file returns the text for the link but not an actual hyperlink. What am I
doing wrong? I just cannot get the hyperlink to work at all. In the
stylesheet I have your example that works fine for <webadd>. I am a
<newbie/> and am sorry for the length but I have tried everything and
nothing seems to work. I would really appreciate any help. Thank you. Joe
Here is the xml file:
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="shops.xsl"?>
<main>
<listing>
<category>
Auto Dealers
</category>
<company>
<name>E-Z Credit Motors
</name>
<address>19465 Sumpter Rd.
Belleville, MI 48111
</address>
<phone>(734) 697-2682
</phone>
<xlink:simple
xmlns:xlink="http://www.w3.org/XML/XLink/0.9"
href="mailto:joe@joeinternet.net">
<email> joe
</email></xlink:simple>
<webadd>click here
</webadd>
</company>
<company>
<name>Gib's Auto Sales
</name>
<address>49412 Michigan Ave.
Belleville, MI 48111
</address>
<phone>(734) 432-9666
</phone>
<email/>
<webadd1>gib</webadd1>
</company>
<company>
<name>Atchinson Ford Sales Inc</name>
<address>9800 Belleville Rd.
Belleville, MI 48111</address>
<phone>(734) 697-9161</phone>
<email/>
<webadd/>
</company>
</listing>
</main>
And here is the xsl file:
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<xsl:template match="/">
<html>
<head><title>Belleville Online Business Listing</title>
</head>
<body>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td>
<div align="center">
<img src="belleville.gif"/>
<br/>
</div>
</td>
</tr>
<tr>
<div align="center"><td>
<table width="100%" cellpadding="2" cellspacing="2" border="1">
<tr><xsl:for-each select="main/listing">
<td class="category" colspan="5" align="center">
<xsl:value-of select="category"/>
</td>
</xsl:for-each>
</tr>
<tr>
<td align="center" class="list">
Name</td>
<td align="center" class="list">
Address</td>
<td align="center" class="list">
Phone</td>
<td align="center" class="list">
Email</td><td align="center" class="list">
Web Address</td>
</tr>
<xsl:for-each select="main/listing/company">
<tr>
<td align="center" class="ind">
<xsl:value-of select="name"/>
</td>
<td align="center" class="ind">
<xsl:value-of select="address"/>
</td>
<td align="center" class="ind">
<xsl:value-of select="phone"/>
</td>
<!--this is where I cannot get this to work. I get "joe" on my webpage but
it is not a hyperlink
<td align="center" class="ind">
<xsl:value-of select="xlink:simple"/>
</td>
//-->
<td align="center" class="ind">
<a href="index.xml"><xsl:value-of select="webadd"/></a>
<a href="http://www.joeinternet.net"><xsl:value-of
select="webadd1"/></a>
</td>
</tr></xsl:for-each>
</table>
</td></div>
</tr>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
----- Original Message -----
From: "Kay Michael" <Michael.Kay@icl.com>
To: <xsl-list@mulberrytech.com>
Sent: Monday, July 17, 2000 10:20 AM
Subject: RE: How to create active hyperlinks from xml file
> > In theory the following should work:
> > <a href="{url}><xsl:value-of select="{url}"/></a>
>
> Read:
> <a href="{url}"><xsl:value-of select="url"/></a>
>
> The select attribute is already an XPath expression, so it doesn't need
(and
> doesn't allow) the curly brackets.
>
> Mike Kay
>
>
> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list