Example of input xml:
Code:
<?xml version = "1.0" encoding = "UTF-8"?>
<departments>
<department>
<title>Department 1</title>
<subdepartment>Dept 1 Sub Dept 1</subdepartment>
<subdepartment>Dept 1 Sub Dept 2</subdepartment>
</department>
<department>
<title>Department 2</title>
<subdepartment>Dept 2 Sub Dept 1</subdepartment>
<subdepartment>Dept 2 Sub Dept 2</subdepartment>
</department>
<department>
<title>Department 3</title>
<subdepartment>Dept 3 Sub Dept 1</subdepartment>
<subdepartment>Dept 3 Sub Dept 2</subdepartment>
</department>
</departments>
The code I'm currently working on I have positioned immediately after the last result-document tag in my above stylessheet:
Code:
<!-- Creating the index file-->
<xsl:result-document href="output/index.html" format="html">
<html><head><title>Index Page</title></head>
<body>
<xsl:for-each select="departments/department/subdepartment">
<xsl:variable name="varDept" select="../title"/>
<a href="'{$varDept}, - ',{.}'.html"><xsl:value-of select="concat($varDept,' - ',.,'.html')"/>
</a><br/>
</xsl:for-each>
</body>
</html>
</xsl:result-document>
This generates a blank index.html, only two of the sub department pages where there should be 16 (and works if I remove my Index creating code) and returns the error:
Error at xsl:result-document on line 44 of copystylesheet.xslt:
XTDE1490: Cannot write more than one result document to the same URI:
file:/C:/websites/diecastcars/webpages/index.html
at xsl:apply-templates (file:/C:/websites/diecastcars/copystylesheet.xslt#23)
processing /categories/category[1]/subcategory[2]
at xsl:apply-templates (file:/C:/websites/diecastcars/copystylesheet.xslt#19)
processing /categories/category[1]
at xsl:apply-templates (file:/C:/websites/diecastcars/copystylesheet.xslt#12)
processing /categories
Transformation failed: Run-time errors were reported
NB: line 44 is:
<xsl:result-document href="webpages/index.html" format="html">