build.xml 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <project basedir="." name="PRINT_TEMPLATE" default="buildpdf">
  3. <!-- Przykładowe wyzwolenie z bash :
  4. cat input.xml | /Library/Server/Web/Data/Sites/Default/SE/stuff/dita-ot-2.3.3/bin/ant -buildfile ild__IN7_DZIENNIK_KORESP.xml
  5. na output mamy pdf'a
  6. -->
  7. <property name="INPUT" value="Test_z_getfeature_do_parse.xml"/>
  8. <tempfile property="tmp.xml" destdir="temp" deleteonexit="yes"/>
  9. <tempfile property="Test_z_getfeature_do_parse__noxml.xml" destdir="temp" deleteonexit="yes"/>
  10. <tempfile property="main__noxml.dita" destdir="temp" deleteonexit="yes"/>
  11. <tempfile property="Test_z_getfeature_do_parse__noxml.xml" destdir="temp" deleteonexit="yes"/>
  12. <tempfile property="main__noxml.dita" destdir="temp" deleteonexit="yes"/>
  13. <tempfile property="out_task.dita" deleteonexit="yes" />
  14. <!--<tempfile destdir="out.dita" deleteonexit="yes"/>-->
  15. <!--<delete file="tmp.xml"/>
  16. <delete file="Test_z_getfeature_do_parse__noxml.xml"/>
  17. <delete file="main__noxml.dita"/>-->
  18. <!--<if>
  19. <available file="${INPUT}" type="file" />
  20. </if>-->
  21. <target name="check" >
  22. <echo message="testuje check"/>
  23. <condition property="test_if_INPUTxml" taskname="buildpdf" value="AVIABLE">
  24. <available file="Test_z_getfeature_do_parse.xml" filepath="." />
  25. </condition>
  26. </target>
  27. <target name="make_inputXML_from_stdin" unless="test_if_INPUTxml">
  28. <echo message="make_inputXML_from_stdin is not aviable appending"/>
  29. <input addproperty="INPUT_from_stdin"/>
  30. <echo message="${INPUT_from_stdin}" file="${INPUT}"/>
  31. <!--<echo file="${test_if_INPUTxml}" message=""/>-->
  32. </target>
  33. <target name="check-info" if="test_if_INPUTxml">
  34. <echo message="Using default XML object on input from file ${INPUT} . "/>
  35. </target>
  36. <target name="buildpdf" depends="check,check-info,make_inputXML_from_stdin">
  37. <echo message="buildpdf to ${test_if_INPUTxml}"/>
  38. <!-- przyklad z uzywaniem saxona ktorego wczesniej trzeba pobrac z port install saxon -->
  39. <xslt style="copy-no-xml.xsl" in="${INPUT}" out="${Test_z_getfeature_do_parse__noxml.xml}"> <!-- {Test_z_getfeature_do_parse__noxml.xml"-->
  40. <factory name="net.sf.saxon.TransformerFactoryImpl">
  41. <attribute name="http://saxon.sf.net/feature/xinclude-aware" value="true"/>
  42. </factory>
  43. <classpath location="/opt/local/share/java/saxon9he.jar"/>
  44. </xslt>
  45. <xslt style="copy-no-xml.xsl" in="main.dita" out="${main__noxml.dita}"/>
  46. <concat destfile="${tmp.xml}" append="true" encoding="UTF-8" >
  47. <string>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  48. &lt;root&gt;</string>
  49. <file file="${Test_z_getfeature_do_parse__noxml.xml}" />
  50. <file file="${main__noxml.dita}"/>
  51. <string>&lt;/root&gt;</string>
  52. </concat>
  53. <xslt basedir="./" style="IN7_DZIENNIK_KORESP.xsl" in="${tmp.xml}" destdir="./" out="${out_task.dita}" >
  54. <factory name="net.sf.saxon.TransformerFactoryImpl">
  55. <attribute name="http://saxon.sf.net/feature/xinclude-aware" value="true"/>
  56. </factory>
  57. <classpath location="/opt/local/share/java/saxon9he.jar"/>
  58. </xslt>
  59. <property name="dita.dir" location="/Library/Server/Web/Data/Sites/Default/SE/stuff/dita-ot-2.3.3/bin/dita"/>
  60. <exec executable="${dita.dir}" dir=".">
  61. <arg value="-i"/>
  62. <arg value="${out_task.dita}" />
  63. <arg value="-f" />
  64. <arg value="pdf"/>
  65. <arg value="-o"/>
  66. <arg value="out"/>
  67. </exec>
  68. <exec executable="bash" dir="." outputproperty="out_task_file">
  69. <arg value="-c"/>
  70. <arg value="echo ${out_task.dita} |sed 's/^.*\///'"/>
  71. </exec>
  72. <!--<propertyregex property="out_file" input="${out_task.dita}" regexp="$.*/(.*)" select="\1."/>-->
  73. <loadfile property="result" srcFile="out/${out_task_file}.pdf"/>
  74. <!--<echo message="input was : ${input}"/>-->
  75. <echo message="OUTPUT_PDF_FILE: out/${out_task_file}.pdf"/>
  76. <!-- <echo message="${result}"/> -->
  77. <!--<propertyregex
  78. name="test"
  79. property="current.target.dir"
  80. input="com.element.subelement"
  81. regexp="\."
  82. replace="/"
  83. global="true" />-->
  84. </target>
  85. </project>