xsl:result-document on the same URI
Added by Anonymous over 18 years ago
Legacy ID: #3870418 Legacy Poster: Rakesh Arora (rakmoh)
I am using xslt to create java classes from a xml file. Script creates multiple java classes (one for each xsl:template match). Name of the file is constructed from the element name and attributes. And i am using the following to write the output file: <xsl:result-document format="text" href="{$filename}"> With this i am getting the following error: XTDE1490: Cannot write more than one result document to the same URI: file:/record/SessionRecord.java Transformation failed: Run-time errors were reported I understand why i am getting this error (same file has already been written) My requirement is to jump to the next match if the file has already been created/written (preferred), or overwrite the existing file. Any idea? Thanks, -Rakesh
Replies (1)
RE: xsl:result-document on the same URI - Added by Anonymous over 18 years ago
Legacy ID: #3870511 Legacy Poster: Michael Kay (mhkay)
Phrases like "if the file has already been created/written" suggest that you're thinking procedurally, and assuming an order of events. Try to think in functional terms: describe the output as a function of the input. If you want an output file X to be generated in respect of the first E where C is true, but not in respect of subsequent Es where C is true, then you need to select all the Es where C is true, then select the first of these, then produce the output. The restriction about writing two trees to the same URI is there because if it were allowed, the final contents of the file would be undefined, because there is no defined order of execution.
Please register to reply