<?xml version="1.0" encoding="ISO-8859-1" ?>
<xsl:stylesheet
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"
  xmlns:xs="XSL"
>
<xsl:output method="text" encoding="ISO-8859-1"/>
<xsl:param name="ctrl" select="'?'" /><!-- it is a control parameter from outside. -->

<xsl:variable name="dependsOnTools" select="'true'" />

<xsl:template match= "/">
  <xsl:text>&lt;?xml version="1.0" encoding="ISO-8859-1"?>
&lt;!-- Generated by GenDocuCtrl2Ant.xslp --&gt;
&lt;project name="GenDocuGen" default="GenDocuGen" basedir="."&gt;

&lt;property environment="env" />

&lt;property name="tmp" value="../tmp" />

&lt;import file="${env.XML_TOOLBASE}/XmlDocu_xsl/GenDocu.ant.xml"/>

	&lt;target name="GenDocuGen" description="The whole documentation of this folder"
	   depends="</xsl:text>
  <xsl:for-each select="GenCtrl/document">
    <xsl:text>(?@ident?).html,</xsl:text>
  </xsl:for-each>
	<xsl:text>copy.special.xsl">
  &lt;/target>



</xsl:text>

  <xsl:apply-templates select="GenCtrl/document" />

  <xsl:apply-templates select="GenCtrl/prepXml" />




  <!-- convert all import.xslp to import.xsl, store it in the tmp directory: -->
  <xsl:for-each select="GenCtrl/import[@type='.xslp']">
    <xsl:variable name="inputfile"><xsl:text>${env.XML_TOOLBASE}/(?@dir?)(?if
      boolean(@dir)?)/(?/if?)(?@href?).xslp</xsl:text></xsl:variable>
    <xsl:text>
  &lt;target name="(?@href?).xslp" depends="isUptodate_(?@href?).xslp" unless="isUptodate_(?@href?).xslp">
  &lt;!-- convert (?@href?).xslp to ${tmp}/(?@href?).xsl. -->
    &lt;echo message="use and Xsltpre: (?$inputfile?)" />
    &lt;exec dir="${curDir}" executable= "cmd.exe" failonerror="true">
  	  &lt;arg line ="/c call java -cp %XML_TOOLBASE%/xslt.jar;%XML_TOOLBASE%/jdom.jar org.vishia.xml.Xsltpre
    --report:${tmp}/xsltpre.rpt --rlevel:324 -i(?$inputfile?) -o${tmp}/(?@href?).xsl"/>
   	&lt;/exec>
  &lt;/target>
  &lt;target name="isUptodate_(?@href?).xslp">
    &lt;uptodate property="isUptodate_(?@href?).xslp" targetfile="${tmp}/(?@href?).xsl" >
      &lt;srcfiles file="${env.XML_TOOLBASE}/(?@dir?)(?if boolean(@dir)?)/(?/if?)(?@href?).xslp" />
    &lt;/uptodate>
  &lt;/target>

    </xsl:text>
  </xsl:for-each>


  <xsl:text>






  &lt;target name="copy.special.xsl" depends="</xsl:text>
  <xsl:for-each select="GenCtrl/import[@type='.xslp']">
    <xsl:text>(?@href?).xslp,</xsl:text>
  </xsl:for-each>
    <xsl:text>dummyTarget">
    &lt;!-- NOTE: the depends targets are conversions from xslp with Xsltpre, they copies there content into tmp.
            The content was produces from the import block of textual GenCtrl. All this files are imported
            in every generateted "docuGenCtrl.xsl" to produce XhtmlPre. They are the "special.xsl"-Files.
            Because the generated "docuGenCtrl.xsl" is placed in the tmp directory, the imports may also placed there.
    -->
    &lt;echo message="copy *.xsl" />
    &lt;copy todir="${curDir}/${tmp}" ></xsl:text>
  <xsl:for-each select="GenCtrl/import[@type='.xsl']">
    <xsl:text>
      &lt;fileset dir="${env.XML_TOOLBASE}/(?@dir?)" includes="(?@href?).xsl" /></xsl:text>
  </xsl:for-each>
  <xsl:text>
    &lt;/copy>
  &lt;/target>



  &lt;target name="dummyTarget">
  &lt;/target>

  &lt;target name="tmpdir">
    &lt;mkdir dir="../tmp" />
  &lt;/target>

  &lt;target name="prepareHtmlOutput">
    &lt;echo message="prepareHtmlOutput" />
    &lt;mkdir dir="../html" />
  &lt;/target>

  &lt;target name="prepareWordOutput">
    &lt;mkdir dir="../word" />
  &lt;/target>





&lt;/project&gt;
</xsl:text>

</xsl:template>






<xsl:template match="document">
  <xsl:text>
  &lt;!-- ********************************************************************************************* -->
  &lt;!-- Generate the output document. It is html, it may be other outputs, see using $ctrl ="(?$ctrl?)" -->

  &lt;target name="(?@ident?).html" depends="isUptodate_(?@ident?).html" unless="isUptodate_(?@ident?).html" >
    &lt;echo message="generating HTML" />
        &lt;antcall target="gen_(?@ident?).html" />
  &lt;/target>
</xsl:text>

  <!-- gen target to generate isUptodate -->

  <xsl:text>
  &lt;target name="isUptodate_(?@ident?).html">
	  &lt;uptodate property="isUptodate_(?@ident?).html" targetfile="../html/(?@ident?).html">
      &lt;srcfiles file="${curDir}/(?!/GenCtrl/@file?)" /> &lt;!-- The NAME.genctrl.txt file itself -->
</xsl:text>
  <xsl:for-each select="input">
    <!-- isUptodate: all input files are sources to test.
         Algorithm: It is possible to specify either the output file of a prepXml-Block,
         the or ones of the input files of a prepXml-Block, or a file immediately.
         If the output file of prepXml is specified, all of the input files are sources.
         If an input file of prepXml is specified without path, the path is taken from prepXml Block,
         in the otherwise case the file is a immediate source.
         To test this cases, 2 variables are filled with a node set reference.
         If one of this variables are valid, its the choice. 
     -->
    <xsl:variable name="input" select="@inputfile" /><!-- ##a -->
    <xsl:variable name="PrepXmlNodeOutput" select="/GenCtrl/prepXml[@outputfile=$input]" />
    <xsl:variable name="PrepXmlNodeInput" select="/GenCtrl/prepXml/input[@file=$input]" />
    <xsl:choose>
      
      <xsl:when test="boolean($PrepXmlNodeOutput)">
        <!-- an output file of prepXml is given, test as isuptodate-src all its inputs: -->
        <xsl:for-each select="$PrepXmlNodeOutput/input">
          <xsl:text>
      &lt;srcfiles file="${curDir}/(?@path?)(?@file?)" />&lt;!-- input of (?$PrepXmlNodeOutput/@outputfile?)
        --></xsl:text>
        </xsl:for-each>
      </xsl:when>
      
      <xsl:when test="boolean($PrepXmlNodeInput)">
        <!-- an input file of prepXml without path is given, test as isuptodate-src with its path: -->
        <xsl:for-each select="$PrepXmlNodeInput[1]">
          <xsl:text>
	    &lt;srcfiles file="${curDir}/(?@path?)(?@file?)" />&lt;!-- converted to (?!../@outputfile?) --></xsl:text><!-- The
  inputfile direct as dependenced -->
        </xsl:for-each>
      </xsl:when>
      
      <xsl:otherwise>
        <xsl:text>
	    &lt;srcfiles file="${curDir}/(?@inputfile?)" /></xsl:text>&lt;!-- The inputfile direct as dependenced -->
      </xsl:otherwise>
      
    </xsl:choose>
  </xsl:for-each>
  <xsl:if test="$dependsOnTools='true'">
    <xsl:for-each select="/GenCtrl/import">
      <!-- dependency from special.xsl (tool) -->
      <xsl:text>
        &lt;srcfiles file="${env.XML_TOOLBASE}/(?@dir?)(?if boolean(@dir)?)/(?/if?)(?@href?)(?@type?)" /></xsl:text>
    </xsl:for-each>
    <xsl:text>
	    &lt;srcfiles file="${env.XML_TOOLBASE}/XmlDocu_xsl/GenDocuCtrl2Xsl.xslp" />
	    &lt;srcfiles file="${env.XML_TOOLBASE}/XmlDocu_xsl/TopicXhtml.xsl" />
	    &lt;srcfiles file="${env.XML_TOOLBASE}/XmlDocu_xsl/Pre2Xhtml.xsl" />
	    &lt;srcfiles file="${env.XML_TOOLBASE}/XmlDocu_xsl/Pre2Word.xsl" />
	    &lt;srcfiles file="${env.XML_TOOLBASE}/Sbnf2Xml/Cheader.sbnf" />
</xsl:text>
  </xsl:if><xsl:text>
	  &lt;/uptodate>
  &lt;/target>

  <!-- gen target to generate html -->
  &lt;target name="gen_(?@ident?).html" depends="tmpdir,(?@ident?).pre.xml">
    &lt;antcall target="prepareHtmlOutput" />
    &lt;exec dir="${curDir}" executable= "java" failonerror="true">
      &lt;arg line ="-cp
        ${env.XML_TOOLBASE}/xslt.jar;${env.XML_TOOLBASE}/jdom.jar;${env.XML_TOOLBASE}/saxon8.jar;${env.XML_TOOLBASE}/sax
        n8-jdom.jar org.vishia.xml.Xslt" />
  	  &lt;arg line="-k${tmp}/(?@ident?).pre.xml" />
  	  &lt;arg line="-i${env.XML_TOOLBASE}/XmlDocu_xsl/HtmlFormatStd.xml" />
  	  &lt;arg line="-t${env.XML_TOOLBASE}/XmlDocu_xsl/Pre2Xhtml.xsl" />
  	  &lt;arg line="-w+ -y../html/(?@ident?).html" />
  	  &lt;arg line="--report:${tmp}/(?@ident?).html.rpt --rlevel:334" />
   	&lt;/exec>
</xsl:text>
  <xsl:if test="contains($ctrl,'word')">
    <xsl:text>
    &lt;antcall target="prepareWordOutput" />
    &lt;exec dir="${curDir}" executable= "java" failonerror="true">
      &lt;arg line ="-cp
        ${env.XML_TOOLBASE}/xslt.jar;${env.XML_TOOLBASE}/jdom.jar;${env.XML_TOOLBASE}/saxon8.jar;${env.XML_TOOLBASE}/sax
        n8-jdom.jar org.vishia.xml.Xslt" />
  	  &lt;arg line="-k${tmp}/(?@ident?).pre.xml" />
  	  &lt;arg line="-i${env.XML_TOOLBASE}/XmlDocu_xsl/WordFormatStd.xml" />
  	  &lt;arg line="-t${env.XML_TOOLBASE}/XmlDocu_xsl/Pre2Word.xsl" />
  	  &lt;arg line="-w- -y../word/(?@ident?).word.xml" />
  	  &lt;arg line="--report:${tmp}/(?@ident?).word.rpt --rlevel:334" />
   	&lt;/exec>
</xsl:text>
  </xsl:if>
  <xsl:text>
  &lt;/target>


  &lt;!-- produce the XhtmlPre File (?@ident?).pre.xml.
       It is a 3-level-conversion:
       * 1.: Convert the common genctrl file (?!/GenCtrl/@file?).xml to the specific (?@ident?).genctrl.xsl File,
         selecting the parametrized document (?@ident?).
       * 2.: The big XSL-Translation to (?@ident?).pre1.xml using some inputs and the xsl-file from 1.
       * 3.: CorrectHref, using (?!/GenCtrl/@file?).xml for HyperlinkAssociations, output is (?@ident?).pre.xml.
   -->
  &lt;target name="(?@ident?).pre.xml"
    depends="</xsl:text>
  <xsl:for-each select="input"><!-- depends on all conversions of inputfiles -->
    <xsl:variable name="input" select="@inputfile" /><!-- ##a -->
    <xsl:for-each select="/GenCtrl/prepXml[@outputfile=$input]">
      <!-- the outputfile is given, it is the dependend target. -->
      <xsl:value-of select="$input" /><xsl:text>, </xsl:text>
    </xsl:for-each>
    <xsl:for-each select="/GenCtrl/prepXml/input[@file=$input]">
      <xsl:choose><xsl:when test="boolean(../@outputfile)"><xsl:value-of select="../@outputfile" /><xsl:text>,
        </xsl:text>
      </xsl:when><xsl:otherwise><xsl:value-of select="$input" /><xsl:text>.xml, </xsl:text>
      </xsl:otherwise></xsl:choose>
    </xsl:for-each>
  </xsl:for-each>
  <xsl:text>
             GenDocuCtrl2Xsl.xsl,
             copy.special.xsl,
             isUptodate_(?@ident?).pre.xml"
    unless="isUptodate_(?@ident?).pre.xml"
  >
    &lt;!-- Generate the XSL translation file for this document: -->
	&lt;exec dir="${curDir}" executable= "cmd.exe" failonerror="true">
  	  &lt;arg line ="/c ${env.XML_TOOLBASE}\xt.exe ${tmp}/(?!/GenCtrl/@file?).xml
    ${env.XML_TOOLBASE}/XmlDocu_xsl/gen/GenDocuCtrl2Xsl.xsl ${tmp}/(?@ident?).genctrl.xsl document=(?@ident?)"/>
   	&lt;/exec>
    &lt;!-- Generate the pre1.xml output: -->
    &lt;exec dir="${curDir}" executable= "java" failonerror="true">
      &lt;arg line ="-cp
        ${env.XML_TOOLBASE}/xslt.jar;${env.XML_TOOLBASE}/jdom.jar;${env.XML_TOOLBASE}/saxon8.jar;${env.XML_TOOLBASE}/sax
        n8-jdom.jar org.vishia.xml.Xslt" />
</xsl:text>
  <xsl:variable name="Inputs">
    <!-- inputs of conversion to pre.xml, consider all input files:
         Algorithm: It is possible to specify either the output file of a prepXml-Block,
         the or ones of the input files of a prepXml-Block, or a file immediately.
         If the output file of prepXml is specified, it is the input for conversion. That is simple.
         If an input file of prepXml is specified, the appropriate output file is the input for conversion.
         Otherwise the specified file is a immediate source.
         
         The problem thereby is, an input for conversion may be kept more as one, 
         because more as one specified input file can determine the same output of prepXml as input for conversion.
         Thats why the files are collected in this variable Inputs,
         than sorted in InputsSort, and at least evaluate for input of conversion.
         
         To test the cases of specified the input, 2 variables inside are filled with a node set reference.
         If one of this variables are valid, its the choice. 
     -->
    <xsl:for-each select="input">
      <xsl:variable name="input" select="@inputfile" /><!-- ##a -->
      <xsl:variable name="PrepXmlNodeOutput" select="/GenCtrl/prepXml[@outputfile=$input]" />
      <xsl:variable name="PrepXmlNodeInput" select="/GenCtrl/prepXml/input[@file=$input]" />
      <xsl:choose>
        
        <xsl:when test="boolean($PrepXmlNodeOutput)">
          <!-- an output file of prepXml is given, its the input for conversion. -->
          <xsl:variable name="AttrInput"><xsl:text>${tmp}/(?$PrepXmlNodeOutput/@outputfile?)</xsl:text></xsl:variable>
          <input file="{$AttrInput}" comment="output after PrepXml direct"/>
        </xsl:when>
        
        <xsl:when test="boolean($PrepXmlNodeInput)">
          <!-- an input file of prepXml without path is given, the appropriate output file is input for conversion: -->
          <xsl:variable name="Outputfile">
            <xsl:choose><xsl:when test="boolean($PrepXmlNodeInput/../@outputfile)"><xsl:value-of
              select="$PrepXmlNodeInput/../@outputfile" />
            </xsl:when><xsl:otherwise><xsl:value-of select="$PrepXmlNodeInput/@file" /><xsl:text>.xml</xsl:text>
            </xsl:otherwise></xsl:choose>
          </xsl:variable>
          <xsl:variable name="Comment"><xsl:text>from (?$PrepXmlNodeInput/@file?)</xsl:text></xsl:variable>  
          <xsl:variable name="AttrInput"><xsl:text>${tmp}/(?$Outputfile?)</xsl:text></xsl:variable>
          <input file="{$AttrInput}" comment="{$Comment}" />
        </xsl:when>
        
        <xsl:otherwise>
          <xsl:variable name="AttrInput"><xsl:text>${curDir}/(?$input?)</xsl:text></xsl:variable>
          <input file="{$AttrInput}" comment="input direct" />
        </xsl:otherwise>
        
      </xsl:choose>
    </xsl:for-each>
  </xsl:variable>
  <xsl:variable name="InputsSort">
    <xsl:for-each select="$Inputs/input">
    <xsl:sort select="@file" />  
      <input file="{@file}" comment="{@comment}" />
    </xsl:for-each>
  </xsl:variable>
  <xsl:for-each select="$InputsSort/input[position()=last() or @file != following-sibling::*[1]/@file]">
  <!-- xsl:for-each select="$InputsSort/input" -->
    <xsl:text>
      &lt;arg line ="-i(?@file?)" />&lt;!-- (?@comment?) --></xsl:text>
  </xsl:for-each>
  <xsl:text>
  	  &lt;arg line ="-i${tmp}/(?!/GenCtrl/@file?).xml" />&lt;!-- the genctrl.xml of this document is also as input
    available -->
  	  &lt;arg line ="-t${tmp}/(?@ident?).genctrl.xsl" />
  	  &lt;arg line ="-w+ -y${tmp}/(?@ident?).pre1.xml" />
  	  &lt;arg line ="--report:${tmp}/(?@ident?).pre1.rpt --rlevel:334"/>
   	&lt;/exec>
    &lt;!-- Generate the pre.xml output after CorrectHref: -->
    &lt;exec dir="${curDir}" executable="java" failonerror="true">
      &lt;arg line ="-cp ${env.XML_TOOLBASE}/xslt.jar;${env.XML_TOOLBASE}/jdom.jar;${env.XML_TOOLBASE}/saxon8.jar
        org.vishia.xml.docuGen.CorrectHref" />
  	  &lt;arg line ="-i${tmp}/(?@ident?).pre1.xml" />
  	  &lt;arg line ="-c${tmp}/(?!/GenCtrl/@file?).xml" />
</xsl:text>
  <xsl:for-each select="inputCrossRef">
    <xsl:text>
  	  &lt;arg line ="-e(?@inputfile?)" /></xsl:text>
  </xsl:for-each>
  <xsl:if test="boolean(xslCrossRef)">
    <xsl:text>
  	  &lt;arg line ="-t${tmp}/(?!xslCrossRef/@href?).xsl" /></xsl:text>
  </xsl:if>
  <xsl:text>
  	  &lt;arg line ="-y${tmp}/(?@ident?).pre.xml" />
  	  &lt;arg line ="--report:${tmp}/(?@ident?).pre.rpt --rlevel:334"/>
   	&lt;/exec>
  &lt;/target>
  &lt;target name="isUptodate_(?@ident?).pre.xml" >
	  &lt;uptodate property="isUptodate_(?@ident?).pre.xml" targetfile="${tmp}/(?@ident?).pre.xml">
      &lt;srcfiles file="${curDir}/(?!/GenCtrl/@file?).txt" />
</xsl:text>
  <xsl:for-each select="input">
    <xsl:text>
	    &lt;srcfiles file="${curDir}/(?@inputpath?)(?@inputfile?)" /></xsl:text>
  </xsl:for-each>
  <xsl:for-each select="/GenCtrl/import">
    <xsl:text>
      &lt;srcfiles file="${tmp}/(?@href?).xsl" /></xsl:text>
  </xsl:for-each>
  <xsl:text>
	    &lt;srcfiles file="${env.XML_TOOLBASE}/XmlDocu_xsl/GenDocuCtrl2Xsl.xslp" />
	    &lt;srcfiles file="${env.XML_TOOLBASE}/XmlDocu_xsl/TopicXhtml.xsl" />
	    &lt;srcfiles file="${env.XML_TOOLBASE}/XmlDocu_xsl/Pre2Xhtml.xsl" />
	    &lt;srcfiles file="${env.XML_TOOLBASE}/Sbnf2Xml/Cheader.sbnf" />
	  &lt;/uptodate>
  &lt;/target>


</xsl:text>

</xsl:template>





<xsl:template match="prepXml">
  <xsl:choose><xsl:when test="@translator='Header2Xml'"><xsl:call-template name="Header2Xml" />
  </xsl:when><xsl:when test="@translator='Header2Xmi'"><xsl:call-template name="Header2Xmi" />  
  </xsl:when><xsl:when test="@translator='xmi2xml'"><xsl:call-template name="xmi2xml" />
  </xsl:when><xsl:when test="@translator='TextTopic2Xml'"><xsl:call-template name="TextTopic2Xml" />
  </xsl:when><xsl:otherwise><xsl:text>&lt;!-- unknown translator: (?@translator?) --></xsl:text>
  </xsl:otherwise></xsl:choose>
</xsl:template>



<xsl:template name= "TextTopic2Xml">
  <xsl:variable name="outputfile"><xsl:text>(?if
    boolean(@outputfile)?)(?@outputfile?)(?else?)(?!input/@file?).xml(?/else?)</xsl:text></xsl:variable>

  <xsl:text>
  &lt;!-- ********************************************************************************************* -->

  &lt;target name="(?$outputfile?)" depends="isUptodate_(?$outputfile?)" unless="isUptodate_(?$outputfile?)" >
    &lt;echo message="update with Zbnf" />
    &lt;exec dir="${curDir}" executable= "java" failonerror="true">
  	  &lt;arg line ="-cp ${env.XML_TOOLBASE}/xslt.jar;${env.XML_TOOLBASE}/jdom.jar org.vishia.zbnfXml.Zbnf2Xml"/>
  	  &lt;arg line ="--rlevel:334 --report:${tmp}/(?$outputfile?).rpt"/>
  	  &lt;arg line ="-i(?!input/@path?)(?!input/@file?) -s${env.XML_TOOLBASE}/Sbnf2Xml/AsciiTopics.sbnf
    -y${tmp}/(?$outputfile?)"/>
   	&lt;/exec>
  &lt;/target>
  &lt;target name="isUptodate_(?$outputfile?)" >
	  &lt;uptodate property="isUptodate_(?$outputfile?)" targetfile="${tmp}/(?$outputfile?)">
	    &lt;srcfiles file="${curDir}/(?!input/@path?)(?!input/@file?)" />
	    &lt;srcfiles file="${env.XML_TOOLBASE}/Sbnf2Xml/AsciiTopics.sbnf" />
	  &lt;/uptodate>
  &lt;/target>

</xsl:text>
</xsl:template>


<xsl:template name= "Header2Xml">
  <xsl:variable name="Outputfile"><xsl:text>(?if
    boolean(@outputfile)?)(?@outputfile?)(?else?)(?!input/@file?).xml(?/else?)</xsl:text></xsl:variable>
  <xsl:text>
  &lt;!-- ********************************************************************************************* -->
  &lt;!-- Some Headerfiles: -->

  &lt;target name="(?$Outputfile?)" depends="isUptodate_(?$Outputfile?)" unless="isUptodate_(?$Outputfile?)" >
    &lt;echo message="parsing Header" />
    &lt;exec dir="${curDir}" executable= "java" failonerror="true">
  	  &lt;arg line ="-cp ${env.XML_TOOLBASE}/xslt.jar;${env.XML_TOOLBASE}/jdom.jar org.vishia.zbnfXml.Zbnf2Xml"/>
  	  &lt;arg line ="--rlevel:334 --report:${tmp}/(?$Outputfile?).rpt"/>
  	  &lt;arg line ="-i(?@inputpath?)(?@inputfile?)"/>
  	  &lt;arg line ="-s${env.XML_TOOLBASE}/Sbnf2Xml/Cheader.sbnf"/>
  	  &lt;arg line ="-y${tmp}/(?$Outputfile?)"/>
   	&lt;/exec>
  &lt;/target>
  &lt;target name="isUptodate_(?$Outputfile?)" >
	  &lt;uptodate property="isUptodate_(?$Outputfile?)" targetfile="${tmp}/(?$Outputfile?)"></xsl:text>
    <xsl:for-each select="input">
      <xsl:text>
	    &lt;srcfiles file="${curDir}/(?@path?)(?@file?)" /></xsl:text>
    </xsl:for-each>
    <xsl:text>  
	    &lt;srcfiles file="${env.XML_TOOLBASE}/Sbnf2Xml/Cheader.sbnf" />
	    &lt;srcfiles file="${env.XML_TOOLBASE}/XmlDocu_xsl/Header2Xmi.xslp" />
	  &lt;/uptodate>
  &lt;/target>

</xsl:text>
</xsl:template>


<xsl:template name= "Header2Xmi">
  <xsl:variable name="Outputfile"><xsl:text>(?if
    boolean(@outputfile)?)(?@outputfile?)(?else?)(?!input/@file?).xmi(?/else?)</xsl:text></xsl:variable>
  <xsl:text>
  &lt;!-- ********************************************************************************************* -->
  &lt;!-- Some Headerfiles collected and converted to XMI: -->
  &lt;target name="(?$Outputfile?)" depends="isUptodate_(?$Outputfile?)</xsl:text>
  <xsl:for-each select="input">
    <xsl:text>,(?$Outputfile?)-(?@file?)</xsl:text>
  </xsl:for-each>
  <xsl:text>" unless="isUptodate_(?$Outputfile?)" >
    &lt;echo message="...running HeaderXmlDissolveTypes.xsl" />
    &lt;exec dir="${curDir}" executable= "java" failonerror="true">
      &lt;arg line ="-cp
        ${env.XML_TOOLBASE}/xslt.jar;${env.XML_TOOLBASE}/jdom.jar;${env.XML_TOOLBASE}/saxon8.jar;${env.XML_TOOLBASE}/sax
        n8-jdom.jar org.vishia.xml.Xslt" /></xsl:text>
  <xsl:for-each select="input">
    <xsl:text>
  	  &lt;arg line="-i${tmp}/(?@file?).xml" />&lt;!-- converted from ZBNF --></xsl:text>  
  </xsl:for-each>        
  <xsl:text>  
      &lt;arg line="-t${env.XML_TOOLBASE}/XmlDocu_xsl/HeaderXmlDissolveTypes.xsl" />
  	  &lt;arg line="-w+ -y${tmp}/(?$Outputfile?).types.xml" />
  	  &lt;arg line="--report:${tmp}/(?$Outputfile?).types.rpt --rlevel:333" />
   	&lt;/exec>
    &lt;echo message="...running HeaderXml2xmi.xsl" />
    &lt;exec dir="${curDir}" executable= "java" failonerror="true">
      &lt;arg line ="-cp
        ${env.XML_TOOLBASE}/xslt.jar;${env.XML_TOOLBASE}/jdom.jar;${env.XML_TOOLBASE}/saxon8.jar;${env.XML_TOOLBASE}/sax
        n8-jdom.jar org.vishia.xml.Xslt" /></xsl:text>
  <xsl:for-each select="input">
    <xsl:text>
  	  &lt;arg line="-i${tmp}/(?@file?).xml" />&lt;!-- converted from ZBNF --></xsl:text>  
  </xsl:for-each>        
  <xsl:text>  	  
      &lt;arg line="-i${tmp}/(?$Outputfile?).types.xml" />
  	  &lt;arg line="-t${env.XML_TOOLBASE}/XmlDocu_xsl/HeaderXml2Xmi.xsl" />
  	  &lt;arg line="-w+ -y${tmp}/(?$Outputfile?)" />
  	  &lt;arg line="--report:${tmp}/(?$Outputfile?).rpt --rlevel:333" />
   	&lt;/exec>
  &lt;/target>

  &lt;target name="isUptodate_(?$Outputfile?)" >
	  &lt;uptodate property="isUptodate_(?$Outputfile?)" targetfile="${tmp}/(?$Outputfile?)"></xsl:text>
    <xsl:for-each select="input">
      <xsl:text>
	    &lt;srcfiles file="${curDir}/(?@path?)(?@file?)" /></xsl:text>
    </xsl:for-each>
    <xsl:text>  
	    &lt;srcfiles file="${env.XML_TOOLBASE}/Sbnf2Xml/Cheader.sbnf" />
	    &lt;srcfiles file="${env.XML_TOOLBASE}/XmlDocu_xsl/Header2Xmi.xslp" />
	  &lt;/uptodate>
  &lt;/target>
  </xsl:text>
  
  <xsl:for-each select="input"><!-- conversion with ZBNF for each input file -->
    <xsl:text>
  &lt;!-- Headerfile converted with ZBNF: -->
  &lt;target name="(?$Outputfile?)-(?@file?)" depends="isUptodate_(?$Outputfile?)-(?@file?)"
    unless="isUptodate_(?$Outputfile?)-(?@file?)" >
    &lt;echo message="...running ZBNF: (?@file?)" />
    &lt;exec dir="${curDir}" executable= "java" failonerror="true">
  	  &lt;arg line ="-cp ${env.XML_TOOLBASE}/xslt.jar;${env.XML_TOOLBASE}/jdom.jar org.vishia.zbnfXml.Zbnf2Xml"/>
  	  &lt;arg line ="--rlevel:334 --report:${tmp}/(?@file?).zbnf.rpt"/>
  	  &lt;arg line ="-i(?@path?)(?@file?)"/>
  	  &lt;arg line ="-s${env.XML_TOOLBASE}/Sbnf2Xml/Cheader.sbnf"/>
  	  &lt;arg line ="-y${tmp}/(?@file?).xml"/>
   	&lt;/exec>
  &lt;/target>
  &lt;target name="isUptodate_(?$Outputfile?)-(?@file?)">
	  &lt;uptodate property="isUptodate_(?$Outputfile?)-(?@file?)" targetfile="(?@file?).xml">
	    &lt;srcfiles file="${curDir}/(?@path?)(?@file?)" />
	    &lt;srcfiles file="${env.XML_TOOLBASE}/Sbnf2Xml/Cheader.sbnf" />
	  &lt;/uptodate>
  &lt;/target>
  </xsl:text>
  </xsl:for-each>
</xsl:template>


<xsl:template name="oldHeader2UmlXml">
  <xsl:variable name="outputfile" />
  <xsl:text>
    
  &lt;target name="(?$outputfile?)" depends="isUptodate_(?$outputfile?)" unless="isUptodate_(?$outputfile?)" >
    &lt;echo message="update with Header2Xmi, ...running ZBNF" />
    &lt;exec dir="${curDir}" executable= "java" failonerror="true">
  	  &lt;arg line ="-cp ${env.XML_TOOLBASE}/xslt.jar;${env.XML_TOOLBASE}/jdom.jar org.vishia.zbnfXml.Zbnf2Xml"/>
  	  &lt;arg line ="--rlevel:334 --report:${tmp}/(?@outputfile?).rpt"/>
  	  &lt;arg line ="-i(?@inputpath?)(?@inputfile?)"/>
  	  &lt;arg line ="-s${env.XML_TOOLBASE}/Sbnf2Xml/Cheader.sbnf"/>
  	  &lt;arg line ="-y${tmp}/(?@inputfile?).xml"/>
   	&lt;/exec>
    &lt;echo message="...running HeaderXmlDissolveTypes.xsl" />
    &lt;exec dir="${curDir}" executable= "java" failonerror="true">
      &lt;arg line ="-cp
        ${env.XML_TOOLBASE}/xslt.jar;${env.XML_TOOLBASE}/jdom.jar;${env.XML_TOOLBASE}/saxon8.jar;${env.XML_TOOLBASE}/sax
        n8-jdom.jar org.vishia.xml.Xslt" />
  	  &lt;arg line="-i${tmp}/(?@inputfile?).xml" />
  	  &lt;arg line="-t${env.XML_TOOLBASE}/XmlDocu_xsl/HeaderXmlDissolveTypes.xsl" />
  	  &lt;arg line="-w+ -y${tmp}/(?@inputfile?).types.xml" />
  	  &lt;arg line="--report:${tmp}/(?@inputfile?).types.rpt --rlevel:333" />
   	&lt;/exec>
    &lt;echo message="...running HeaderXml2xmi.xsl" />
    &lt;exec dir="${curDir}" executable= "java" failonerror="true">
      &lt;arg line ="-cp
        ${env.XML_TOOLBASE}/xslt.jar;${env.XML_TOOLBASE}/jdom.jar;${env.XML_TOOLBASE}/saxon8.jar;${env.XML_TOOLBASE}/sax
        n8-jdom.jar org.vishia.xml.Xslt" />
  	  &lt;arg line="-i${tmp}/(?@inputfile?).xml" />
  	  &lt;arg line="-i${tmp}/(?@inputfile?).types.xml" />
  	  &lt;arg line="-t${env.XML_TOOLBASE}/XmlDocu_xsl/HeaderXml2Xmi.xsl" />
  	  &lt;arg line="-w+ -y${tmp}/(?$outputfile?)" />
  	  &lt;arg line="--report:${tmp}/(?$outputfile?).rpt --rlevel:333" />
   	&lt;/exec>
  &lt;/target>
  &lt;target name="isUptodate_(?$outputfile?)" >
	  &lt;uptodate property="isUptodate_(?$outputfile?)" targetfile="${tmp}/(?$outputfile?)">
	    &lt;srcfiles file="${curDir}/(?@inputpath?)(?@inputfile?)" />
	    &lt;srcfiles file="${env.XML_TOOLBASE}/Sbnf2Xml/Cheader.sbnf" />
	    &lt;srcfiles file="${env.XML_TOOLBASE}/XmlDocu_xsl/HeaderXml2UmlXml.xsl" />
	  &lt;/uptodate>
  &lt;/target>

</xsl:text>
  
</xsl:template>




<xsl:template name= "xmi2xml">
  <xsl:text>
  &lt;!-- ********************************************************************************************* -->
  &lt;!-- xmi2xml: -->

  &lt;target name="(?@outputfile?)" depends="isUptodate_(?@outputfile?)" unless="isUptodate_(?@outputfile?)" >
    &lt;echo message="update with Xmi2Xml" />
    &lt;exec dir="${curDir}" executable= "cmd.exe" failonerror="true">
  	  &lt;arg line ="/c ${env.XML_TOOLBASE}/../xmi2xml\xmi2xml.bat (?@inputpath?)(?@inputfile?) ${tmp}/(?@outputfile?)"/>
   	&lt;/exec>
  &lt;/target>
  &lt;target name="isUptodate_(?@outputfile?)" >
	  &lt;uptodate property="isUptodate_(?@outputfile?)" targetfile="${tmp}/(?@outputfile?)">
	    &lt;srcfiles file="${curDir}/(?@inputpath?)(?@inputfile?)" />
	  &lt;/uptodate>
  &lt;/target>

</xsl:text>
</xsl:template>


</xsl:stylesheet>