<?xml version="1.0"?>

<project name="style-test" basedir="." default="nothing">

  <property name="out.dir" value="out"/>


  <target name="setup">
  </target>

  <target name="teardown">
      <delete dir="${out.dir}" failonerror="false" />
  </target>

  <target name="testStyleIsSet">
      <style in="data.xml" out="${out.dir}/out.xml"/>
  </target>

  <target name="testTransferParameterSet">
      <property name="value" value="myvalue"/>
      <style in="data.xml" out="${out.dir}/out.xml" style="printParams.xsl">
          <param name="set" expression="${value}"/>
      </style>
  </target>

  <target name="testTransferParameterEmpty">
      <property name="value" value=""/>
      <style in="data.xml" out="${out.dir}/out.xml" style="printParams.xsl">
          <param name="empty" expression="${value}"/>
      </style>
  </target>

  <target name="testTransferParameterUnset">
      <style in="data.xml" out="${out.dir}/out.xml" style="printParams.xsl">
          <param name="undefined" expression="${value}"/>
      </style>
  </target>

  <target name="testTransferParameterUnsetWithIf">
      <style in="data.xml" out="${out.dir}/out.xml" style="printParams.xsl">
          <param name="undefined" expression="${value}" if="value" />
      </style>
  </target>

  <target name="testDefaultMapper">
    <property name="value" value="myvalue"/>
    <style style="printParams.xsl" destDir="${out.dir}" basedir=".">
      <param name="set" expression="${value}"/>
    </style>
  </target>

  <target name="testCustomMapper">
    <property name="value" value="myvalue"/>
    <style style="printParams.xsl" destDir="${out.dir}" basedir=".">
      <param name="set" expression="${value}"/>
      <mapper type="glob" from="data.*" to="out.*"/>
    </style>
  </target>

  <target name="testNewerStylesheet">
      <antcall target="copyXsl">
        <param name="xsl.value" value="old-value"/>
      </antcall>
      <style in="data.xml" out="${out.dir}/out.xml" style="tmp.xsl"/>

      <antcall target="copyXsl">
        <param name="xsl.value" value="new-value"/>
      </antcall>
      <style in="data.xml" out="${out.dir}/out.xml" style="tmp.xsl"/>
      <delete file="tmp.xsl"/>
  </target>

  <target name="copyXsl" if="xsl.value">
      <copy file="testNewerStylesheet.xsl" tofile="tmp.xsl" overwrite="true">
          <filterchain><expandproperties/></filterchain>
      </copy>
  </target>

</project>