I've been trying to create an xslt template, but it keeps silently failing like as if an exception is happening but is not being caught. The closing bracket is not being written out, invalidating the output;
the XML file
<?xml version="1.0"?>
<gallery>
<item>
<file>IMAGEHEADER1.jpg</file>
<thelink>michaeljackson123.htm</thelink>
</item>
<item>
<file>IMAGEHEADER2.jpg</file>
<thelink>barrywhite456.htm</thelink>
</item>
</gallery>
XSLT File
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="/">
<html>
<body>
<table>
<tr>
<xsl:apply-templates />
</tr>
</table>
</body>
</html>
</xsl:template>
<xsl:template match="gallery">
<xsl:for-each select="item">
<xsl:value-of select="position()"/>
<xsl:choose>
<xsl:when test="position() = 1">
<td rowspan="2" height="122" width="510">
<xsl:apply-templates select="." />
</td>
</xsl:when>
</xsl:choose>
</xsl:for-each>
</xsl:template>
<xsl:template match="item">
<a style="display:block;width:520px;height:330px" id="categorylink">
<xsl:attribute name="href">
<xsl:value-of select="thelink"/>
</xsl:attribute>
<xsl:apply-templates select="file" />
</a>
</xsl:template>
<xsl:template match="file">
<img alt="">
<xsl:attribute name="src">
<xsl:value-of select="."/>
</xsl:attribute>
</img>
</xsl:template>
</xsl:stylesheet>
Invalid output, missing the closing tab.
<html>
<body>
<tr>1<td rowspan="2" height="122" width="510"><a style="display:block;width:520px;height:330px" id="categorylink" href="michaeljackson123.htm"><img alt="" src="IMAGEHEADER1.jpg"></a></td>2</tr>
</body>
</html>
My expected output is;
<html>
<body>
<table>
<tr>1
<td rowspan="2" height="122" width="510">
<a style="display:block;width:520px;height:330px" id="categorylink" href="michaeljackson123.htm">
<img alt="" src="IMAGEHEADER1.jpg"></img>
</a>
</td>2
</tr>
</table>
</body>
</html>
Please help, can't see why it's failing.