You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by David Balch <da...@continuing-education.oxford.ac.uk> on 2004/01/26 10:29:12 UTC

Bug? URL encoding issues with redirect:write via Ant

Hi,

I'm having problems getting an XSLT using the redirect:write extension in
Xalan to work correctly with Ant, and don't know whether it is a bug in Ant,
or a bug in Xalan trigered by Ant.

There's a thread discussing it (mostly the same as this post) on ant-users:
http://article.gmane.org/gmane.comp.jakarta.ant.user/21644/. I also posted
this mail to xalan-users, but recieved no responses.


Summary:
Using the Ant <xslt> task when the path has spaces in it will cause output
from the redirect:write extension to be written to a URL encoded version of
the path.

The testcase below works fine from command line, but not Ant.

Expected results: "test.txt" and "test2.txt" in:
"C:\Documents and Settings\BalchD\My Documents\working-copy".

Actual results (Ant):
"test.txt" in:  "C:\Documents and Settings\BalchD\My
Documents\working-copy";
"test2.txt" in:
"C:\Documents%20and%20Settings\BalchD\My%20Documents\working-copy".

Actual results (Command line): "test.txt" and "test2.txt" in: 
"C:\Documents and Settings\BalchD\My Documents\working-copy";

---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
ant.">
  <xslt in="test.xml" out="test.txt" style="test.xsl"/>
</target>


---8<--- XML source ---8<---

<?xml version="1.0" encoding="UTF-8"?>
<test>
    <one>Hello, this is one.</one>
    <two>Hello, this is two.</two>
</test>


---8<--- XSL ---8<---

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:redirect="http://xml.apache.org/xalan/redirect"
extension-element-prefixes="redirect">
    <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>
</xsl:stylesheet>


---8<--- END ---8<---

So, where do I file the bug?

Cheers,
Dave.

-- 
David Balch.          | Web developer.
T: +44 (0)1865 286932 | Technology-Assisted Lifelong Learning.
F: +44 (0)1865 286922 | University of Oxford.

TALL, OUDCE and the University of Oxford accept no legal responsibility for
the contents of this message. Any views or opinions presented are only those
of the author and not those of TALL, or OUDCE, or the University of Oxford.
If this email has come to you in error please delete it and any attachments