[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] Creating Hyperlinks using xlink


Subject: [xsl] Creating Hyperlinks using xlink
From: "Rudi Starcevic" <rudi@xxxxxxxxxxxx>
Date: Wed, 9 Jul 2003 23:53:38 +1000

Hi,

When creating an active link from an xml file using xlink, code below,
all works fine except selecting the 'href' attribute.

I had some code creating an active hyperlink working without xlink
but soon found out that if one want to pass in parameter's with the href,
eg index.php?id=1&action=login&type=new, xlink is required.

In my code below everything render's well except the actual value, @href,
for the <a></a> tag.

For example this line from my 'address' xsl:template,
<a href="{xlink:simple/@href}"><xsl:value-of select="."/></a>,
in the rendered html document the {xlink:simple/@href} is blank but the
<xsl:value-of select="."/> is fine.

I must be missing something simple again.
Sure is tricky this xslt but I sure like it.

Can you see where I'm going wrong ?

Thanks
Regards
Rudi.

XML file:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="webapps.xsl"?>

<webapps xmlns:xlink="http://www.w3.org/1999/xlink">

<website name="Footyworld">

<address
 xlink:type="simple"
 xlink:href="http://www.footyworld.com">www.footyworld.com</address>

</website>	

</webapps>

XSL file:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" 
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	xmlns:xlink="http://www.w3.org/XML/XLink/0.9">

<xsl:template match="/">
<html>
<head><title>Web app. list</title></head>
<body>

<xsl:for-each select="webapps/website">
<table border="1" summary="Web Application Table">
 <xsl:apply-templates select="address"/>
</table>
</xsl:for-each>

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

<xsl:template match="address">
<tr>
<td>URL:</td>
<td><a href="{xlink:simple/@href}"><xsl:value-of select="."/></a></td>
</tr>
</xsl:template>

</xsl:stylesheet>


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



Current Thread
Keywords