ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Patrick Surry <>
Subject Re: AW: Custom ant task with nested 'literal' XML data fragment?
Date Fri, 24 Oct 2003 14:03:08 GMT
OK, I'd thought of that, it just looks a bit ugly to have to embed XML in
CDATA.  I wondered if my setStyle() method could somehow get access to the DOM
fragment for its content and process it itself (without triggering any of Ant's
inner setXXX methods) rather than have to parse a string from a CDATA section



Hi Patrick,
it is perfectly possible to write a custom task which will accept the nested
literal XML data fragment.
You might want to take a look at the <echo/> task and at the <replace/>

in your build file, you need to enclose your XML fragment in <![CDATA[
section like this :
<xslt in="foo.xml" out="bar.xml>
    <xsl:transform xmlns:xsl=""
      <xsl:template match="something">
        <!-- more random xslt stuff -->

Your build file fragment suggests that you have an <xslt> task with a
<style> nested element.
In the class representing in Java the style nested element you need then to
insert this method :
(copied from :
     * Set the XSL fragment inline.
    public void addText(String msg) {
        // replaceProperties allows as its name suggest to replace
${something} tokens with their value.
        xsltext = getProject().replaceProperties(msg);

Hopes this helps,


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

View raw message