[usage] File to set

Description

Transformation and generation tasks let you process many output files from one input file.

use inner element <foreach line="current_line” infile="in.csv”/>

            +---+
            |   |
+---+       |   |
|   | +---> +---+
|   | +---> +---+
+---+       |   |
            |   |
            +---+

Task parameters

Attribute Description Value Required
todir output dir yes
template freemarker template .ftl yes (or inner template)
Element Description Value Required
foreach foreach element no
template inner template element no

Use cases

  • split : split large files

ant file - build.xml

Autosplit Large CSV Files into Smaller Pieces

<bj:csvt todir="${tmp.dir}/{id}" overwrite="true" extension=".xml">
	<foreach line="current_line" infile="${tmp.dir}/in2.csv">
		<condition property="not_needed_but_mandatory">
		    <equals arg1="{id}" arg2="t03"/>
		</condition>
	</foreach>
	<template><![CDATA[<?xml version="1.0"?>
<task id="${current_line.id}">
  <label>${current_line['label']}</label>
  <content>${current_line.content}</content>
</task>]]>			
	</template>
</bj:csvt>