PDA

View Full Version : Using <a href=""> in XSL



CRASH_OVERRIDE
Dec 22nd, 2002, 04:12 AM
I have a simple XML doc, and am styling it with XSL.
One problem i havent been able to figure out, is the following:
XML:


<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="menu.xsl"?>

<menu>
<item id="webtech">
<arrow>true</arrow>
<action>showSub('webtechSub')</action>
<content>Web Technologies</content>
</item>

<item id="resources">
<arrow>false</arrow>
<action>showSub('resourcesSub')</action>
<content>Resources</content></item>

<item id="projects">
<arrow>true</arrow>
<action>showSub('projectsSub')</action>
<content>Projects</content>
</item>

<item id="tools">
<arrow>false</arrow>
<action>showSub('toolsSub')</action>
<content>Tools</content>
</item>

<item id="downloads">
<arrow>true</arrow>
<action>showSub('downloadsSub')</action>
<content>Downloads</content>
</item>
</menu>

XSL:


<?xml version="1.0" encoding="ISO-8859-1"?>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">

<html>

<head>
<title>Menu</title>
<link rel="stylesheet" type="text/css" href="../global.css" />
</head>

<body>
<table cellpadding="0" cellspacing="0" border="0" width="650px" height="" class="menu" align="center">
<tr>
<xsl:for-each select="menu/item">
<td align="center" width="20%"><a class="menu" hidefocus="hidefocus" href="@content"><xsl:value-of select="content" /><img src="../images/blank.gif" /></a></td>
</xsl:for-each>
</tr>
</table>
</body>

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

I want to get the href attribute in the XSL doc to get the data from the <action> node in the XML

jkd
Dec 22nd, 2002, 04:50 AM
href="{action}"

CRASH_OVERRIDE
Dec 22nd, 2002, 10:59 PM
Thanks, thats all :)