ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Antoine Lévy-Lambert <>
Subject Re: redirect:write not writing to separate files with ant
Date Fri, 16 Jan 2004 22:43:31 GMT
Hi David,

I am not sure whether the problem detected by Michael Hudson is fixed now.

The code of has certainly changed quite a bit since then.

this message of Robert Koberg is also interesting

My experience is that one easily gets into trouble with file resolution 
issues with xalan, independently of ant too.

For instance I have a web application where I was trying to do 
<xsl:import href='xyz'/> and I discovered that xalan was trying to
resolve the hrefs relative to the directory of the input file rather 
than relative to the directory of the current stylesheet.

So in my opinion your test2.txt gets generated, but is maybe in the 
directory on the input data or of the xsl stylesheet, in any case not 
where you wanted it to be.
I also suffered the first time I tried to use xalan:redirect.


Antoine Levy-Lambert
David Balch wrote:

>I'm having problems getting an XSLT using the redirect:write extension in
>Xalan to work with Ant. The attached testcase works fine from command line,
>but not Ant.
>Expected results: Two text files - "test.txt" and "test2.txt".
>Actual results (Ant): One text file - "test.txt"
>Actual results (Command line): Two text files - "test.txt" and "test2.txt".
>A look through the mailing list archive found a similar problem in 2001 [0],
>but I suspect that's fixed by now ;-). I would appreciate if anyone could
>suggest what's going wrong...
>---8<--- Setup ---8<---
>WinXP SP1
>java version "1.4.1_02"
>Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_02-b06)
>Java HotSpot(TM) Client VM (build 1.4.1_02-b06, mixed mode)
>Apache Ant version 1.6alpha compiled on September 6 2003
>Xalan Version Xalan Java 2.5.0
>---8<--- Command line ---8<---
>java org.apache.xalan.xslt.Process -IN test.xml -XSL test.xsl -OUT test.txt
>---8<--- Ant target ---8<---
><target name="redirect" description="Test of redirect:write in xslt via
>  <xslt in="test.xml" out="test.txt" style="test.xsl"/>
>---8<--- XML source ---8<---
><?xml version="1.0" encoding="UTF-8"?>
>    <one>Hello, this is one.</one>
>    <two>Hello, this is two.</two>
>---8<--- XSL ---8<---
><?xml version="1.0" encoding="UTF-8"?>
><xsl:stylesheet version="1.0"
>    <xsl:output method="text"/>
>    <xsl:template match="/test">
>        <xsl:for-each select="one">
>            <xsl:value-of select="."/>
>        </xsl:for-each>
>        <xsl:for-each select="two">
>            <redirect:write select="'test2.txt'">
>                <xsl:value-of select="."/>
>            </redirect:write>
>        </xsl:for-each>
>    </xsl:template>
>---8<--- END ---8<---
>I can write XSL testcases, but I don't really know Java, so any suggestions
>would be great.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message