Forum Moderators: open
and so on. The report1Name will be replaced by the actual name of the report which will be the hypertext and on clicking will bring up the report page. Also I need to sort this column by report name
I plan to have the xml file containing data on the report names and the corresponding urls with the structure:
catalog/report/name
catalog/report/url
I am unable to generate just one column in the table that will have the report name as a hyperlink. xsl will not let me pull the url part containing the valueas <a href="...">
Any help is greatly appreciated.
I have whipped up this example, I hope it helps. There are three parts, the xml, xsl and an ant build file to do the transform.
<?xml version="1.0"?>
<cat>
<reports>
<report>
<name>a</name>
<url>http://localhost/report.jsp?id=1</url>
</report>
<report>
<name>c</name>
<url>http://localhost/report.jsp?id=2</url>
</report>
<report>
<name>b</name>
<url>http://localhost/report.jsp?id=2</url>
</report>
</reports>
</cat>
<?xml version="1.0"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<div class="title-style">
<xsl:text>Enterprise Reports</xsl:text>
</div>
<xsl:for-each select="/cat/reports/report">
<xsl:sort select="name" order="ascending"/>
<div class="item-style">
<a href="{url}">
<xsl:value-of select="name" />
</a>
</div>
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
<?xml version="1.0"?>
<project name="WebmasterWorld" default="go" basedir=".">
<target name="go">
<style basedir="." destdir="." extension=".html" style="xsl.xsl" includes="data.xml" excludes="nothing.xml" classpath="C:/saxon8/saxon8.jar">
</style>
</target>
</project>