I am a bit of a novice and am running into trouble when trying to
create the xsl file to format my xml document. My xml document is of
the form:
<articles>
<publication>
<title>Title</title>
<filename>/dir/filename.txt</filename>
<authors>Author </authors>
<source>Sourc e</source><date>Da te</date>
</publication>
<articles>
I want the data to be formatted as follows at the end:
<table>
<tr><td><a href="/dir/filename.txt">T itle</a></td></tr>
<tr><td>Autho r</td></tr>
<tr><td>Sourc e</td></tr>
<tr><td>Date</td></tr>
</table>
I have come up with the following xsl file, but I cannot get the href
to work because it requires me to nest tags. I realzie the formatting
is a bit different, but this should be irrelevant.
<?xml version="1.0" encoding="iso-8859-1" ?>
<xsl:styleshe et xmlns:xsl="http ://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:template match="articles ">
<html><head><ti tle><xsl:text>R eference</xsl:text></title></head>
<body>
<h1><xsl:text>A rticles</xsl:text></h1>
<table border="0" cellpadding="2" cellspacing="2" >
<xsl:apply-templates/>
</table>
</body>
</html>
</xsl:template>
<xsl:template match="publicat ion">
<tr>
<td><b><a href="child::fi lename"><xsl:va lue-of
select="title"/></a></b></td>
</tr>
<tr>
<td><xsl:valu e-of select="authors "/></td>
</tr>
<tr>
<td><xsl:valu e-of select="source"/><xsl:text>,
</xsl:text><xsl:v alue-of select="date"/></td>
</tr>
<tr>
<td colspan="3"><br ></br></td>
</tr>
</xsl:template>
</xsl:stylesheet>
Can someone please help a novice out?
Thanks!
create the xsl file to format my xml document. My xml document is of
the form:
<articles>
<publication>
<title>Title</title>
<filename>/dir/filename.txt</filename>
<authors>Author </authors>
<source>Sourc e</source><date>Da te</date>
</publication>
<articles>
I want the data to be formatted as follows at the end:
<table>
<tr><td><a href="/dir/filename.txt">T itle</a></td></tr>
<tr><td>Autho r</td></tr>
<tr><td>Sourc e</td></tr>
<tr><td>Date</td></tr>
</table>
I have come up with the following xsl file, but I cannot get the href
to work because it requires me to nest tags. I realzie the formatting
is a bit different, but this should be irrelevant.
<?xml version="1.0" encoding="iso-8859-1" ?>
<xsl:styleshe et xmlns:xsl="http ://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:template match="articles ">
<html><head><ti tle><xsl:text>R eference</xsl:text></title></head>
<body>
<h1><xsl:text>A rticles</xsl:text></h1>
<table border="0" cellpadding="2" cellspacing="2" >
<xsl:apply-templates/>
</table>
</body>
</html>
</xsl:template>
<xsl:template match="publicat ion">
<tr>
<td><b><a href="child::fi lename"><xsl:va lue-of
select="title"/></a></b></td>
</tr>
<tr>
<td><xsl:valu e-of select="authors "/></td>
</tr>
<tr>
<td><xsl:valu e-of select="source"/><xsl:text>,
</xsl:text><xsl:v alue-of select="date"/></td>
</tr>
<tr>
<td colspan="3"><br ></br></td>
</tr>
</xsl:template>
</xsl:stylesheet>
Can someone please help a novice out?
Thanks!
Comment