Re: Appending output to multiple documents
Hi Rafael, > Been playing a bit with Saxon and its partial implementation of the > XSLT 1.1 draft. here. I've been wondering if there is a way for > multiple <xsl:document/> constructions that reference the same file > to *append* their outputs to the file instead of truncating the > original file and replacing its contents. Useful for the case where > I had two different templates that had to spew their output to the > same file, in the order they were matched. Is there something in the > standard I missed, or is this currently impossible and I would need > to hack my XSLT processor and then propose to the W3C a mode > attribute to <xsl:document/> that would control whether output to > files that already exist should be appended or overwritten? There isn't a way to do that. You could propose it to W3C, but I doubt that they would adopt it. The way that xsl:document works is complicated by the fact that it's designed to maintain the same kind of basic XSLT processing model as the rest of XSLT. This means that the order in which things are actually processed shouldn't matter - you're building a tree, which is then serialised, not writing to an output sequentially. You will be able to create the secondary output in just the same way as you are able to create the primary output - think of them as two completely separate processes. Alternatively, the redirect:write extension element in Xalan does allow you to append a document, if you open it first with redirect:open. So if you are desperate for that functionality, then you could use that. Cheers, Jeni --- Jeni Tennison http://www.jenitennison.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format