ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rebhan, Gilbert" <>
Subject xmltask, xpath related question
Date Tue, 12 Jun 2007 14:49:35 GMT


with a given xmlfile as input for my buildscript =

<?xml version="1.0"?>

    <projekt name="safir">
        <modul name="SAFIR Base Application" label="r_1_5_13_23_thi"/>
    <projekt name="kuba">
        <modul name="KUBA" label="r_1_0_0_0_za_rc26"/>
        <modul name="PONE" label="r_1_0_0_0_za_rc26"/>

i need to call a cvscheckout macrodef for every modul found in the xml;
the cvsroot varies in the projekt name attribute.

I have a working script =

<?xml version="1.0"?>

<project name="bla" default="main" basedir=".">

  <!-- // Taskdefs -->
  <!-- Import XMLTask -->
  <taskdef name="xmltask"
classname="com.oopsconsultancy.xmltask.ant.XmlTask" />
  <!-- Taskdefs // -->

  <!-- // Import MacroDefs -->
  <import file="common_macros.xml" optional="false" />
  <!-- Import MacroDefs // -->

  <target name="init">
    <xmltask source="Reference.xml">
      <call path="//projekt" target="precvscheckout" >
        <param name="projektname" path="@name"/>

  <target name="precvscheckout">
    <echo>... in precvscheckout</echo>

    <xmltask source="Reference.xml">
      <call path="//projekt[@name='${projektname}']/modul"
target="cvscheckout" >
        <param name="mname" path="@name"/>
        <param name="mlabel" path="@label"/>

  <target name="cvscheckout">
  ============== cvscheckout ================  
      Projektname = ${projektname}
      Modul       = ${mname}
      Label       = ${mlabel}
  ============== cvscheckout ================  


  <target name="main" depends="init"/>

so my script has one xmltask calling another xmltask for every projekt,
second xmltask is called for every modul.

is there a more elegant, shorter  approach with xpath ?

Regards, Gilbert

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

View raw message