<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet version="2.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:xs="XSL"
>
<xsl:output method="text" encoding="iso-8859-1"/>
<xsl:param name="document" select="'?'" />



<xsl:template match= "/">
  <xsl:text>&lt;?xml version="1.0" encoding="iso-8859-1"?>
</xsl:text>
  <xsl:text>
&lt;xsl:stylesheet version="2.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:topics="http://www.vishia.de/2006/Topics"
  xmlns:pre="http://www.vishia.de/2006/XhtmlPre"
  xmlns:xhtml="http://www.w3.org/1999/xhtml"
  xmlns:UML="omg.org/UML13"
&gt;

&lt;!-- this file is generated using xmlDocu_xsl/GenDocuCtrl2Xsl.xslp --&gt;

</xsl:text>

  <!-- select of the requested document in DocuGenCtrl.xml, some variants, supporting multi documents in 1 genCtr-File,
    than call work -->
  <xsl:choose><xsl:when test="count(GenCtrl/document)>0 and $document!='?'"><xsl:for-each
    select="GenCtrl/document[@ident=$document]" ><xsl:call-template name="work"/></xsl:for-each></xsl:when>
  <xsl:when test="count(GenCtrl/document)>0"><xsl:for-each select="GenCtrl/document" ><xsl:call-template
    name="work"/></xsl:for-each></xsl:when>
  <xsl:when test="count(GenCtrl)>0"><xsl:for-each select="GenCtrl" ><xsl:call-template
    name="work"/></xsl:for-each></xsl:when>
  </xsl:choose>

  <xsl:text>
&lt;/xsl:stylesheet>
</xsl:text>

</xsl:template>







<xsl:template name= "work">

  <xsl:for-each select="import|../import">
    <xsl:text>
&lt;xsl:import href="</xsl:text><xsl:value-of select="@href"/><xsl:text>.xsl" /&gt;</xsl:text>
  </xsl:for-each>
  <xsl:text>
&lt;xsl:output method="xml" encoding="iso-8859-1"/>

&lt;xsl:variable name="document.ident" select="(?$document?)" /&gt;

&lt;xsl:variable name="testOutput">2&lt;/xsl:variable>

&lt;xsl:template match="/|/root">
  &lt;pre:Chapters title="</xsl:text><xsl:value-of select="@title"/><xsl:text>" &gt;
</xsl:text>
    <xsl:apply-templates/>
<xsl:text>
  &lt;/pre:Chapters>
&lt;/xsl:template>
</xsl:text>
</xsl:template>



 <xsl:template match="chapter">
<xsl:text>&lt;pre:chapter (?if count(@id)>0?)id="(?@id?)"(?/if?)&gt; &lt;pre:title></xsl:text><xsl:value-of
  select="title"/>&lt;/pre:title>
<xsl:text/>
    <xsl:apply-templates/>
<xsl:text/>
<xsl:text/>
<xsl:text/>&lt;/pre:chapter>
<xsl:text/>
</xsl:template>


<xsl:template match="title">
  <!-- no output, it is used by xsl:value-of in chapter -->
</xsl:template>


<xsl:template match="inset">
  <!-- no output, it is used inside evaluation. -->
</xsl:template>


  <xsl:template match="topic">
    <xsl:variable name="IdentString" select="@select"/>
    <!-- build the select as text string in output xsl-script -->
    <!-- xsl:variable name="Select">/root/Topics<xsl:text/ -->
    <xsl:variable name="Select">/root/<xsl:text/>
      <xsl:call-template name="SelectTopic">
        <xsl:with-param name="IdentString" select="$IdentString"/>
      </xsl:call-template>
    </xsl:variable>
<xsl:text>
    &lt;xsl:apply-templates select="(?$Select?)"&gt;
      </xsl:text><xsl:text>(?if count(@divStyle)>0?)  &lt;xsl:with-param name="divStyle"   select="'(?@divStyle?)'"  
        /&gt;(?/if?)</xsl:text><xsl:text>
      </xsl:text><xsl:text>(?if count(@pStyle)>0?)    &lt;xsl:with-param name="pStyle"     select="'(?@pStyle?)'"    
        /&gt;(?/if?)</xsl:text><xsl:text>
      </xsl:text><xsl:text>(?if count(@ulStyle)>0?)   &lt;xsl:with-param name="ulStyle"    select="'(?@ulStyle?)'"   
        /&gt;(?/if?)</xsl:text><xsl:text>
      </xsl:text><xsl:text>(?if count(@olStyle)>0?)   &lt;xsl:with-param name="olStyle"    select="'(?@olStyle?)'"   
        /&gt;(?/if?)</xsl:text><xsl:text>
      </xsl:text><xsl:text>(?if count(@dlStyle)>0?)   &lt;xsl:with-param name="dlStyle"    select="'(?@dlStyle?)'"   
        /&gt;(?/if?)</xsl:text><xsl:text>
      </xsl:text><xsl:text>(?if count(@tableStyle)>0?)&lt;xsl:with-param name="tableStyle" select="'(?@tableStyle?)'"
        /&gt;(?/if?)</xsl:text><xsl:text>
    &lt;/xsl:apply-templates&gt;</xsl:text>
    <xsl:call-template name="genErrorNotFound"><xsl:with-param name="select" select="$Select"/></xsl:call-template>
	</xsl:template>


  <xsl:template name="SelectTopic">
  <xsl:param name="IdentString"/>
    <xsl:variable name="Ident2" select="substring-after($IdentString,'/')"/>
    <xsl:variable name="Ident1" select="substring-before($IdentString,'/')"/>
    <xsl:choose>
      <xsl:when test="string-length($Ident2)>0">
        <!-- build the select as text string in output xsl-script -->
        <xsl:text>/topics:topic[@ident='</xsl:text>
          <xsl:value-of select="$Ident1"/>
        <xsl:text>']</xsl:text>

        <xsl:choose>
          <xsl:when test="$Ident2='*'">
            <!-- build the select as text string in output xsl-script -->
            <xsl:text>/*</xsl:text>
          </xsl:when>
          <xsl:when test="string-length($Ident2)>0">
            <xsl:call-template name="SelectTopic">
              <xsl:with-param name="IdentString" select="$Ident2"/>
            </xsl:call-template>
          </xsl:when>
        </xsl:choose>
      </xsl:when>
      <xsl:otherwise>
        <xsl:text>/topics:topic[@ident='</xsl:text>
          <xsl:value-of select="$IdentString"/>
        <xsl:text>']</xsl:text>
      </xsl:otherwise>
    </xsl:choose>
	</xsl:template>




  <!-- underlined output -->
  <xsl:template match="u">
<xsl:text/>&lt;p>&lt;u><xsl:value-of select="."/>&lt;/u>&lt;/p>
<xsl:text/>
  </xsl:template>


  <!-- normal output -->
  <xsl:template match="p">
<xsl:text>&lt;xhtml:body&gt;</xsl:text>
<xsl:text/>&lt;xhtml:p><xsl:value-of select="."/>&lt;/xhtml:p>
<xsl:text/>
<xsl:text>&lt;/xhtml:body&gt;</xsl:text>
  </xsl:template>


  <!-- include a picture -->
  <xsl:template match="picture">
    <xsl:choose><xsl:when test="count(@imgMap)>0">
      <xsl:text>
        &lt;xsl:for-each select="/root/imgMap/img[@name='(?@imgMap?)']"&gt;
          &lt;xsl:copy-of select="." /&gt;
        &lt;/xsl:for-each&gt;
      </xsl:text>
    </xsl:when><xsl:otherwise>
      <xsl:text>&lt;img src="(?@file?)" title="(?@title?)" />
</xsl:text>
    </xsl:otherwise></xsl:choose>
  </xsl:template>


  <!-- umlClass -->
  <xsl:template match="umlClass_old">
<xsl:text/>&lt;xsl:call-template name="umlClass">&lt;xsl:with-param name="ident" select="'<xsl:value-of
  select="@select"/>'"/>&lt;/xsl:call-template>
<xsl:text/>
  </xsl:template>

  <!-- umlClassShort -->
  <xsl:template match="umlClassShort">
    <xsl:text>&lt;xsl:call-template name="umlClass"&gt;&lt;xsl:with-param name="ident" select="'</xsl:text>
    <xsl:value-of select="@select"/>
    <xsl:text>'" /&gt;&lt;xsl:with-param name="kind" select="'short'" /&gt;&lt;/xsl:call-template&gt;</xsl:text>
  </xsl:template>





  <xsl:template match="xxxumlCommentPkg">
    <xsl:variable name="IdentString" select="@select"/>
    <!-- build the select as text string in output xsl-script -->
    <xsl:variable name="Select">/root/XMI/XMI.content/UML:Model/UML:Namespace.ownedElement<xsl:text/>
      <xsl:call-template name="xxxSelectUmlCommentPkg">
        <xsl:with-param name="IdentString" select="$IdentString"/>
      </xsl:call-template>
    </xsl:variable>
<xsl:text/>&lt;p expandWikistyle="true" style="standard" &gt;&lt;xsl:value-of select="<xsl:value-of
  select="$Select"/>"/&gt;&lt;/p&gt;
<xsl:text/>
	</xsl:template>


  <xsl:template name="xxxSelectUmlCommentPkg">
  <xsl:param name="IdentString"/>
    <xsl:variable name="Ident2" select="substring-after($IdentString,'/')"/>
    <xsl:variable name="Ident1" select="substring-before($IdentString,'/')"/>
    <xsl:choose>
      <xsl:when test="string-length($Ident2)>0">
        <xsl:text>/Package[@name='</xsl:text><xsl:value-of select="$Ident1"/><xsl:text>']</xsl:text>
        <xsl:call-template name="SelectUmlCommentPkg">
          <xsl:with-param name="IdentString" select="$Ident2"/>
        </xsl:call-template>
      </xsl:when>
      <xsl:otherwise>
        <xsl:text>/Dependency/Comment/tag[starts-with(.,'</xsl:text><xsl:value-of
          select="$IdentString"/><xsl:text>')]</xsl:text>
      </xsl:otherwise>
    </xsl:choose>
	</xsl:template>





  <xsl:template match="xxxumlStatechart">
    <xsl:text>&lt;xsl:for-each select="/root/XMI/XMI.content/UML:Model/UML:Namespace.ownedElement</xsl:text>
    <xsl:call-template name="buildUmlSelectPkgClassNameIntern">
      <xsl:with-param name="IdentString" select="@select"/>
      <xsl:with-param name="InternSelect1" select="'/UML:Class[@name='" />
      <xsl:with-param name="InternSelect2" select="']'" />
    </xsl:call-template>  <!-- in xsl-output variable select1 and select2 are defined. -->
    <xsl:text>"&gt;&lt;xsl:call-template name="umlStatechart" /&gt;&lt;/xsl:for-each&gt;</xsl:text>
	</xsl:template>



  <xsl:template match="umlPkg">
    <xsl:call-template name="callUmlSelect">
      <xsl:with-param name="IdentString" select="@select"/>
      <xsl:with-param name="InternSelect1" select="'UML:Package[@name='" />
      <xsl:with-param name="InternSelect2" select="''" />
      <xsl:with-param name="callName" select="'pkgContent'" />
    </xsl:call-template>
  </xsl:template>


  <xsl:template match="umlClass">
    <xsl:variable name="param">
      <!-- Assignment of the xsl-text of calling parameters in form "xsl:with-param..."
           This variable will be left empty if optional attributes are not present.
        -->
      <xsl:if test="count(@attributes)>0">
        <xsl:text>&lt;xsl:with-param name="attributes" select="'</xsl:text><xsl:value-of
          select="@attributes"/><xsl:text>'" /&gt;</xsl:text>
      </xsl:if>
      <xsl:if test="count(@methods)>0">
        <xsl:text>&lt;xsl:with-param name="methods" select="'</xsl:text><xsl:value-of select="@methods"/><xsl:text>'"
          /&gt;</xsl:text>
      </xsl:if>
      <xsl:if test="count(@title)>0">
        <xsl:text>&lt;xsl:with-param name="title" select="'(?@title?)'" /&gt;</xsl:text>
      </xsl:if>
    </xsl:variable>
    <xsl:variable name="fromHeader">
      <xsl:if test="boolean(@header)">and boolean(@headerStruct)</xsl:if>
    </xsl:variable>
    <xsl:call-template name="callUmlSelect">
      <xsl:with-param name="IdentString" select="@select"/>
      <xsl:with-param name="InternSelect1" select="'UML:Class[@name='" />
      <xsl:with-param name="InternSelect2" select="$fromHeader" />
      <xsl:with-param name="callName" select="'umlClassContent'" />
      <xsl:with-param name="callParam" select="$param"/>
    </xsl:call-template>
	</xsl:template>


  <xsl:template match="umlIfc">
    <xsl:variable name="param">
      <!-- Assignment of the xsl-text of calling parameters in form "xsl:with-param..."
           This variable will be left empty if optional attributes are not present.
        -->
      <xsl:if test="count(@methods)>0">
        <xsl:text>&lt;xsl:with-param name="methods" select="'</xsl:text><xsl:value-of select="@methods"/><xsl:text>'"
          /&gt;</xsl:text>
      </xsl:if>
      <xsl:if test="count(@title)>0">
        <xsl:text>&lt;xsl:with-param name="title" select="'(?@title?)'" /&gt;</xsl:text>
      </xsl:if>
    </xsl:variable>
    <xsl:variable name="fromHeader">
      <xsl:if test="boolean(@header)">and boolean(@headerStruct)</xsl:if>
    </xsl:variable>
    <xsl:call-template name="callUmlSelect">
      <xsl:with-param name="IdentString" select="@select"/>
      <xsl:with-param name="InternSelect1" select="'UML:Interface[@name='" />
      <xsl:with-param name="InternSelect2" select="$fromHeader" />
      <xsl:with-param name="callName" select="'umlClassContent'" />
      <xsl:with-param name="callParam" select="$param"/>
    </xsl:call-template>
	</xsl:template>


  <xsl:template match="umlStatechart">
    <xsl:call-template name="callUmlSelect">
      <xsl:with-param name="IdentString" select="@select"/>
      <xsl:with-param name="InternSelect1" select="'UML:Class[@name='" />
      <xsl:with-param name="InternSelect2" select="''" />
      <xsl:with-param name="callName" select="'umlStatechart'" />
    </xsl:call-template>  <!-- in xsl-output variable select1 and select2 are defined. -->
	</xsl:template>



  <xsl:template match="umlComment">
    <xsl:call-template name="callUmlSelect">
      <xsl:with-param name="IdentString" select="@select"/>
      <xsl:with-param name="InternSelect1" select="'UML:Comment[starts-with(@body,'" />
      <xsl:with-param name="InternSelect2" select="')'" />
      <xsl:with-param name="callName" select="'umlComment'" />
    </xsl:call-template>  <!-- in xsl-output variable select1 and select2 are defined. -->
	</xsl:template>


  <xsl:template match="umlSQD">
    <xsl:call-template name="callUmlSelect">
      <xsl:with-param name="IdentString" select="@select"/>
      <xsl:with-param name="InternSelect1" select="'UML:Collaboration[@name='" />
      <xsl:with-param name="InternSelect2" select="''" />
      <xsl:with-param name="callName" select="'umlSQDdescription'" />
    </xsl:call-template>  <!-- in xsl-output variable select1 and select2 are defined. -->
	</xsl:template>


  <!-- in the older version of Rhapsody the statemachine was inside the class. -->
  <xsl:template match="OldumlStateD">
    <xsl:call-template name="callUmlSelect">
      <xsl:with-param name="IdentString" select="@select"/>
      <xsl:with-param name="InternSelect1" select="'UML:Class[@name='" />
      <xsl:with-param name="InternSelect2" select="''" />
      <xsl:with-param name="callName" select="'umlStateD'" />
    </xsl:call-template>  <!-- in xsl-output variable select1 and select2 are defined. -->
  </xsl:template>



  <xsl:template match="umlStateD">
    <xsl:call-template name="callUmlSelect">
      <xsl:with-param name="IdentString" select="@select"/>
      <xsl:with-param name="InternSelect1" select="'UML:StateMachine[@name='" />
      <xsl:with-param name="InternSelect2" select="''" />
      <xsl:with-param name="callName" select="'umlStateD'" />
    </xsl:call-template>  <!-- in xsl-output variable select1 and select2 are defined. -->
  </xsl:template>



  <xsl:template match="umlStateReport">
    <xsl:call-template name="callUmlSelect">
      <xsl:with-param name="IdentString" select="@select"/>
      <xsl:with-param name="InternSelect1" select="'UML:StateMachine[@name='" />
      <xsl:with-param name="InternSelect2" select="''" />
      <xsl:with-param name="callName" select="'umlStateReport'" />
    </xsl:call-template>  <!-- in xsl-output variable select1 and select2 are defined. -->
  </xsl:template>



  <xsl:template name="xxxbuildUmlSelectPkgClassName">
  <!-- this template builds the content of a variable or text output -->
  <xsl:param name="IdentString"/>
  <xsl:param name="InternSelect1"/>
  <xsl:param name="InternSelect2"/>
    <!-- build the first select variable in created XSL: -->
    <xsl:text>&lt;xsl:variable name="select1"&gt;/root/XMI/XMI.content/UML:Model/UML:Namespace.ownedElement</xsl:text>
    <xsl:call-template name="buildUmlSelectPkgClassNameIntern">
      <xsl:with-param name="IdentString" select="$IdentString" />
      <xsl:with-param name="InternSelect1" select="$InternSelect1"/>
      <xsl:with-param name="InternSelect2" select="$InternSelect2"/>
    </xsl:call-template>
  </xsl:template>


  <xsl:template name="xxxbuildUmlSelectPkgClassNameIntern">
  <!-- recursively called intern routine -->
  <xsl:param name="IdentString"/>
  <xsl:param name="InternSelect1"/>
  <xsl:param name="InternSelect2"/>
    <xsl:variable name="IdentPkg" select="substring-before($IdentString,':')"/>
    <xsl:choose><xsl:when test="string-length($IdentPkg)>0">
      <xsl:text>/Package[@name='</xsl:text><xsl:value-of select="$IdentPkg"/><xsl:text>']</xsl:text>
      <xsl:call-template name="buildUmlSelectPkgClassNameIntern">
        <xsl:with-param name="IdentString" select="substring-after($IdentString,':')" />
        <xsl:with-param name="InternSelect1" select="$InternSelect1"/>
        <xsl:with-param name="InternSelect2" select="$InternSelect2"/>
      </xsl:call-template>
    </xsl:when>
    <xsl:otherwise>
      <!-- no more ':' found, now look for '.' -->
      <xsl:variable name="IdentClass" select="substring-before($IdentString,'.')"/>
      <xsl:choose><xsl:when test="string-length($IdentClass)>0">
        <xsl:text>/UML:Class[@name='</xsl:text><xsl:value-of select="$IdentClass"/><xsl:text>']</xsl:text>
        <xsl:call-template name="buildUmlSelectPkgClassNameIntern">
          <xsl:with-param name="IdentString" select="substring-after($IdentString,'.')" />
          <xsl:with-param name="InternSelect1" select="$InternSelect1"/>
          <xsl:with-param name="InternSelect2" select="$InternSelect2"/>
        </xsl:call-template>
      </xsl:when>
      <xsl:otherwise>
        <!-- no more ':' or '.' found, now ends  variable "select1", the rest is "select2" -->
        <xsl:value-of select="$InternSelect1"/>
        <xsl:text>'</xsl:text>
        <xsl:value-of select="$IdentString"/>
        <xsl:text>'</xsl:text>
        <xsl:value-of select="$InternSelect2"/>
      </xsl:otherwise>
      </xsl:choose>

    </xsl:otherwise>
    </xsl:choose>

	</xsl:template>






  <xsl:template name="callUmlSelect">
  <!-- This template is called in every element requireness and prepares the statements in the output xsl
       to execute the action.
       The Identstring is parsed and converted to the string format useable to select in docuSrc.uml.xml-file
       (xschema uml13.xsd).
       To process that, a recursively call of recursivelyBuildUmlSelect is done.
  -->
  <xsl:param name="IdentString"/>
  <xsl:param name="InternSelect1"/>
  <xsl:param name="InternSelect2"/>
  <xsl:param name="callName"/>
  <xsl:param name="callParam"/><!-- The whole string like &lt;xsl:with-param name="xyz"&gt; .... &lt;/xsl:with-param&gt;
    -->
    <xsl:variable name="modelSelect">
      <xsl:if test="contains(@select, ':')">
        <xsl:text>[@name='(?!substring-before(@select,':')?)']</xsl:text>
      </xsl:if>
    </xsl:variable>
    <xsl:variable name="select">
      <xsl:choose>
        <xsl:when test="contains(@select, ':')"><xsl:value-of select="substring-after(@select, ':')" /></xsl:when>
        <xsl:otherwise><xsl:value-of select="@select" /></xsl:otherwise>
      </xsl:choose>
    </xsl:variable>
    <xsl:text>
            &lt;!-- created by callUmlSelect --&gt;
            &lt;!-- param=</xsl:text><xsl:value-of select="$callParam"/><xsl:text>  --&gt;
            &lt;xsl:for-each
              select="/root/XMI/XMI.content/UML:Model(?$modelSelect?)/UML:Namespace.ownedElement/</xsl:text>
    <xsl:call-template name="recursivelyBuildUmlSelect">
      <xsl:with-param name="IdentString" select="$select"/>
      <xsl:with-param name="InternSelect1" select="$InternSelect1" />
      <xsl:with-param name="InternSelect2" select="$InternSelect2" />
      <xsl:with-param name="callName" select="$callName" />
      <xsl:with-param name="callParam" select="$callParam" />
      <xsl:with-param name="callName" select="$callName" />
    </xsl:call-template>

    <xsl:text>&lt;/xsl:for-each&gt;
            &lt;xsl:if
              test="count(/root/XMI/XMI.content/UML:Model(?$modelSelect?)/UML:Namespace.ownedElement/</xsl:text>
    <xsl:variable name="PARAM">
      <xsl:text>&lt;xsl:with-param name="param1" select="'</xsl:text>
      <xsl:value-of select="$IdentString"/>
      <xsl:text>'"/&gt;</xsl:text>
    </xsl:variable>
    <xsl:call-template name="recursivelyBuildUmlSelect">
      <xsl:with-param name="IdentString" select="$select"/>
      <xsl:with-param name="InternSelect1" select="$InternSelect1" />
      <xsl:with-param name="InternSelect2" select="$InternSelect2" />
      <xsl:with-param name="InternSelect3" select="')=0'"/>
      <xsl:with-param name="callName" select="'errorNotFound'" />
      <xsl:with-param name="callParam" select="$PARAM" />
    </xsl:call-template>  <!-- in xsl-output variable select1 and select2 are defined. -->
    <xsl:text>&lt;/xsl:if&gt;
            </xsl:text>


	</xsl:template>


  <xsl:template name="recursivelyBuildUmlSelect">
  <!-- recursively called intern routine -->
  <xsl:param name="IdentString"/>
  <xsl:param name="InternSelect1"/>
  <xsl:param name="InternSelect2"/>
  <xsl:param name="InternSelect3"/>
  <xsl:param name="callName"/>
  <xsl:param name="callParam"/>
    <xsl:choose><xsl:when test="starts-with($IdentString,'**/')">
      <!-- the selected element should be searched at any location inside the uml tree: -->

        <xsl:text>/</xsl:text> <!-- NOTE: in XSL it is a recursive descent operator to select all childs of the actual
          node. -->
        <xsl:call-template name="recursivelyBuildUmlSelect">
          <xsl:with-param name="IdentString" select="substring-after($IdentString,'**/')" />
          <xsl:with-param name="InternSelect1" select="$InternSelect1"/>
          <xsl:with-param name="InternSelect2" select="$InternSelect2"/>
          <xsl:with-param name="InternSelect3" select="$InternSelect3"/>
          <xsl:with-param name="callName" select="$callName"/>
          <xsl:with-param name="callParam" select="$callParam"/>
        </xsl:call-template>
    </xsl:when>
    <xsl:otherwise>
      <xsl:variable name="IdentPkg" select="substring-before($IdentString,'/')"/>
      <xsl:choose><xsl:when test="string-length($IdentPkg)>0">

        <!-- selection of a package with the given name -->
        <xsl:text>UML:Package[@name='</xsl:text><xsl:value-of select="$IdentPkg"/><xsl:text>']/</xsl:text>
        <xsl:call-template name="recursivelyBuildUmlSelect">
          <xsl:with-param name="IdentString" select="substring-after($IdentString,'/')" />
          <xsl:with-param name="InternSelect1" select="$InternSelect1"/>
          <xsl:with-param name="InternSelect2" select="$InternSelect2"/>
          <xsl:with-param name="InternSelect3" select="$InternSelect3"/>
          <xsl:with-param name="callName" select="$callName"/>
          <xsl:with-param name="callParam" select="$callParam"/>
        </xsl:call-template>
      </xsl:when>
      <xsl:otherwise>
        <!-- no more '/' found, now look for '.' -->
        <xsl:variable name="IdentClass" select="substring-before($IdentString,'.')"/>
        <xsl:choose><xsl:when test="string-length($IdentClass)>0">

          <!-- selection of a class with the given name -->
          <xsl:text>UML:Class[@name='</xsl:text><xsl:value-of select="$IdentClass"/><xsl:text>']/</xsl:text>
          <xsl:call-template name="recursivelyBuildUmlSelect">
            <xsl:with-param name="IdentString" select="substring-after($IdentString,'.')" />
            <xsl:with-param name="InternSelect1" select="$InternSelect1"/>
            <xsl:with-param name="InternSelect2" select="$InternSelect2"/>
            <xsl:with-param name="InternSelect3" select="$InternSelect3"/>
            <xsl:with-param name="callName" select="$callName"/>
            <xsl:with-param name="callParam" select="$callParam"/>
          </xsl:call-template>
        </xsl:when>
        <xsl:otherwise>

          <!-- no more '/' or '.' found, now ends  variable "select1", the rest is "select2" -->

          <!-- write the last selection condition -->
          <xsl:value-of select="$InternSelect1"/>
          <xsl:text>'</xsl:text><xsl:value-of select="$IdentString"/><xsl:text>'</xsl:text>
          <xsl:value-of select="$InternSelect2"/><xsl:text>]</xsl:text><xsl:value-of select="$InternSelect3"/>
          <xsl:text>"&gt;
              </xsl:text>

          <!-- write the call-template -->
          <xsl:text>&lt;xsl:call-template name="</xsl:text>
          <xsl:value-of select="$callName"/>
          <xsl:text>" &gt;</xsl:text>
          <xsl:value-of select="$callParam"/>
          <xsl:text>&lt;/xsl:call-template&gt;
            </xsl:text>
        </xsl:otherwise>
        </xsl:choose>
      </xsl:otherwise></xsl:choose>

    </xsl:otherwise></xsl:choose>

	</xsl:template>




  <xsl:template match="dataStruct">
    <xsl:text>
        &lt;!-- xsl:for-each select="/root/Cheader/class[@name='</xsl:text><xsl:value-of select="@select"/><xsl:text>']"
          --&gt;
        &lt;xsl:for-each select="/root"&gt;
          &lt;xsl:call-template name="dataStruct"&gt;
            &lt;xsl:with-param name="className" select="'</xsl:text><xsl:value-of select="@select"/><xsl:text>'" /&gt;
          &lt;/xsl:call-template&gt;
        &lt;/xsl:for-each&gt;
        &lt;xsl:if test="count(/root/Cheader/class[@name='</xsl:text><xsl:value-of
          select="@select"/><xsl:text>'])=0"&gt;
          &lt;p style='standard'&gt;&lt;b&gt;ERROR: not found ---</xsl:text><xsl:value-of
            select="@select"/><xsl:text>---&lt;/b&gt;&lt;/p&gt;
        &lt;/xsl:if&gt;
    </xsl:text>
	</xsl:template>



  <xsl:template match="CLASS_C">
    <xsl:text>
        &lt;!-- xsl:for-each select="/root/Cheader/class[@name='</xsl:text><xsl:value-of select="@select"/><xsl:text>']"
          --&gt;
        &lt;xsl:for-each select="/root"&gt;
          &lt;xsl:call-template name="headerClass"&gt;
            &lt;xsl:with-param name="className" select="'</xsl:text><xsl:value-of select="@select"/><xsl:text>'" /&gt;
          &lt;/xsl:call-template&gt;
        &lt;/xsl:for-each&gt;
        &lt;xsl:if test="count(/root/Cheader/class[@name='</xsl:text><xsl:value-of
          select="@select"/><xsl:text>'])=0"&gt;
          &lt;p style='standard'&gt;&lt;b&gt;ERROR: not found ---</xsl:text><xsl:value-of
            select="@select"/><xsl:text>---&lt;/b&gt;&lt;/p&gt;
        &lt;/xsl:if&gt;
    </xsl:text>
	</xsl:template>



  <xsl:template match="DEFINE_C">
    <xsl:text>
        &lt;!-- xsl:for-each select="/root/Cheader/DEFINE_C[@name='</xsl:text><xsl:value-of
          select="@select"/><xsl:text>']" --&gt;
        &lt;xsl:for-each select="/root"&gt;
          &lt;xsl:call-template name="headerDefine"&gt;
            &lt;xsl:with-param name="name" select="'</xsl:text><xsl:value-of select="@select"/><xsl:text>'" /&gt;
          &lt;/xsl:call-template&gt;
        &lt;/xsl:for-each&gt;
        &lt;xsl:if test="count(/root/Cheader/DEFINE_C[@name='</xsl:text><xsl:value-of
          select="@select"/><xsl:text>'])=0"&gt;
          &lt;p style='standard'&gt;&lt;b&gt;ERROR: not found ---</xsl:text><xsl:value-of
            select="@select"/><xsl:text>---&lt;/b&gt;&lt;/p&gt;
        &lt;/xsl:if&gt;
    </xsl:text>
	</xsl:template>






  <!-- call -->
  <xsl:template match="call">
    <xsl:text/>
        &lt;xsl:for-each select="/root/<xsl:value-of select="@select"/>"&gt;
          &lt;xsl:call-template name="<xsl:value-of select="@name"/>"&gt;&lt;/xsl:call-template&gt;
        &lt;/xsl:for-each&gt;
        &lt;xsl:if test="count(/root/<xsl:value-of select="@select"/>)=0"&gt;
          &lt;xhtml:p style='standard'&gt;ERROR: not found ---<xsl:value-of select="@select"/>---&lt;/xhtml:p&gt;
        &lt;/xsl:if&gt;
<xsl:text/>
  </xsl:template>



  <xsl:template match="allRequirements">
    <xsl:text/>
      &lt;xhtml:body&gt;
        &lt;xsl:for-each select="/root//Requirement"&gt;
          &lt;xsl:call-template name="Requirement"&gt;&lt;/xsl:call-template&gt;
        &lt;/xsl:for-each&gt;
        &lt;xsl:if test="count(//Requirement)=0"&gt;
          &lt;p style='standard'&gt;&lt;b&gt;ERROR: not found ---Requirement---&lt;/b&gt;&lt;/p&gt;
        &lt;/xsl:if&gt;
      &lt;/xhtml:body&gt;
<xsl:text/>
  </xsl:template>



  <xsl:template match="crossRef">
  <!-- if the element crossRef is found, in the generated xsl script
       the superior node (should be a pre:chapter) will be getted the followed attribute.
   -->
    <xsl:text>
      &lt;xhtml:body crossRefContent="(?@content?)"&gt;
      &lt;/xhtml:body&gt;
</xsl:text>
  </xsl:template>



  <xsl:template name="genErrorNotFound">
  <xsl:param name="select" />
    <xsl:text>
        &lt;xsl:if test="count((?$select?))=0"&gt;
          &lt;xhtml:body&gt;&lt;xhtml:p style='standard'&gt;ERROR: not found
            ---(?$select?)---&lt;/xhtml:p&gt;&lt;/xhtml:body&gt;
        &lt;/xsl:if&gt;
</xsl:text>
  </xsl:template>



  <xsl:template match="HyperlinkAssociation">
  </xsl:template>


</xsl:stylesheet>