XSLT Error Reference
XTDE1490
Error message
Cannot write more than one result document to the same URITwo xsl:result-document instructions resolved to the same output URI — usually a static href inside a loop. Make the href dynamic.
What it means
xsl:result-document writes an output file per invocation. If two invocations produce the same href, the second would overwrite the first — the spec forbids it and Saxon raises XTDE1490.
Common causes
- Static
hrefinsidexsl:for-each— every iteration writes to the same name:
<!-- Before: every customer writes to out.xml → XTDE1490 -->
<xsl:for-each select="customer">
<xsl:result-document href="out.xml">…</xsl:result-document>
</xsl:for-each>
<!-- After: unique URI per iteration -->
<xsl:for-each select="customer">
<xsl:result-document href="customer-{@id}.xml">…</xsl:result-document>
</xsl:for-each>
- Duplicate keys in the data —
href="{@id}.xml"with two equal@idvalues. Deduplicate first (xsl:for-each-group group-by="@id"). - Writing to the principal output URI while also producing normal output.
How to fix it
Build the href from something guaranteed unique: a key from the data, position(), or generate-id(). See xsl:result-document for the full syntax and a runnable example.