You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Johannes van der Merwe <jp...@iafrica.com> on 2001/11/28 14:29:42 UTC

Suggestion for Redirect.java extension

Hi all

I needed to have the redirect xalan extension open files in append mode as
well, so that multiple stylesheet templates could append output to the same
file. This was achieved by recompiling the xalan jar with the modified
Redirect.java, and by using the extension like:

<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	xmlns:redirect="org.apache.xalan.xslt.extensions.Redirect"
    extension-element-prefixes="redirect"
	>

<xsl:variable name="myfile" select="concat("whatever",'.','txt')"/>

<redirect:open select="$myfile" mkdirs="true" append="true"/>
<redirect:write select="$myfile">
....whatever....
</redirect:write>
<redirect:close select="$myfile"/>

later writes to this file will not truncate the file first, then.

Any comments welcome.

Kind regards
Jo van der Merwe


		J.P. van der Merwe

		Technical Consultant : Business Integration

		Dimension Data i-Commerce Software

		4Tel: +27 011 263 5244

		4Switchboard +27 011 263 5000

		4Mobile: +27 082 322 6406

		4Fax: +27 011 263 5301

		4Helpdesk +27 086 1100 686

		4Email Johannes.VDM@za.didata.com <ma...@za.didata.com>

		4Website <http://www.ic.didata.com/>