ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Koberg <...@koberg.com>
Subject Re: Editing an XML file using ant
Date Wed, 19 Sep 2007 18:09:33 GMT
On Wed, 2007-09-19 at 13:45 -0400, broken connection wrote:
> Hi Friends,
> 
> I want to add some extra mime-mappings to an web.xml file  in the deployment
> environment using my build script.I am trying using "XMLTASK" but for some
> reason it's not working. Is there any other way using ANT to accomplish this
> task.

You could use the XSLT task with:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
  <xsl:template match="@*|node()">
    <xsl:copy>
      <xsl:apply-templates select="@*"/>
      <xsl:apply-templates/>
    </xsl:copy>
  </xsl:template>
  
  <xsl:template match="mime-mapping[1]">
    <xsl:apply-templates select="document('insert.xml')/*"/>
    <xsl:copy-of select="."/>
    <xsl:apply-templates/>
  </xsl:template>
</xsl:stylesheet>


> 
> This is what i am trying with XMLTask:
> 
> <xmltask source="${dest}/web.xml" dest="${dest}/web.xml" >
>    <insert path="/web-app/mime-mapping[1]" position="before" file="
> insert.xml">
>    </insert>
> </xmltask>
> 
> It just copies the source web.xml to destination and does not appends
> anything.
> 
> 
> Thanks
> Mick


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message