ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jo Support <jo.supp...@gmail.com>
Subject Re: xmlTask - Help
Date Mon, 22 Nov 2010 15:17:49 GMT
Finally I realized that library XmlTask from Oops is nothing more than
a XSLT engine, and it uses the same mechanics, so I found (thanks to
your example) the right syntax to get what I wanted using that
library:

		<xmltask preservetype="true" report="true"
source="${workDir}/house_original.xml"
dest="${workDir}/house_new.xml">
			<replace path="/house/room[tapestry='red']/floor/text()"
withText="terracotta"/>
		</xmltask>

This code does the job correctly.

For those who have the same problem, using "@" refers to an attribute,
and without "@" refers to an internal tag.

Thanks a lot!

best regards
Jo


On Mon, Nov 22, 2010 at 3:11 PM, Ludwig, Michael
<Michael.Ludwig@delphi-mb.de> wrote:
>> In your particular use case, you can use xslt. You just need
>> to write an xsl file doing the change that you would like.
>
> Here's the XSL file you need:
>
> <xsl:stylesheet version="1.0"
>  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
>
>  <xsl:template match="room[tapestry='red']/floor">
>    <xsl:copy>terracotta</xsl:copy>
>  </xsl:template>
>
>  <xsl:template match="@*|node()">
>    <xsl:copy>
>      <xsl:apply-templates select="@*|node()"/>
>    </xsl:copy>
>  </xsl:template>
>
> </xsl:stylesheet>
>
> Best,
>
> Michael
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>

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


Mime
View raw message