How it is possible to overwrite an existing (XML) file with XSLT?
Currently, using <xsl:result-document/>
I get the following ERROR
Cannot write to a URI that has already been read
I found an advice to delete the file before, but they don't explain how. I wonder if there should be a simpler solution to do this.
Here is the sample code. I am using Saxon 9.8.0.12 in Oxygen XML editor 20.1
<xsl:variable name="process">
<xsl:apply-templates mode="process" select="doc($processedFile)"/>
</xsl:variable>
<xsl:template match="/">
<xsl:result-document href="{$processedFile}" indent="yes" method="xml">
<xsl:copy-of select="$process"/>
</xsl:result-document>
</xsl:template>