<?xml version='1.0' encoding='utf-8'?>

<!-- 

======================================================================================
Firma:            Voith Turbo
Projekt:          Voith Diagnostic Tools XSL-Formating for HTML Presentation of CAN-Data
Dateiname:        CAN_MessageList.XSL

Beschreibung:     XSL - Template for CAN-Data-Formating
                 Erzeugt eine auflistung aller CAN-Botschaften incl. Versionierung
Doc in:           No
Ersterstellung:   /2009 - RThe
======================================================================================

 -->


<xsl:stylesheet version='2.0'
xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>


  <xsl:template name="CAN2HTML_Formater_MessageList" match=' / '>
    
    <br/>
    <br/>
    <!-- 
          ** Alle verwendeten Botschaften in allen Versionen
    -->

    <table border="0" width="900" id="table101" >

      <tr>
        <td class='TabBorder1' width='30'  >Typ</td>
        <td class='TabBorder1' width='40'  >Name</td>
        <td class='TabBorder1' width='240' >Description</td>
        <td class='TabBorder1' width='60'  >Version</td>
        <td class='TabBorder1'>Valid to</td>
        <td class='TabBorder1'>Optional</td>
      </tr>
     
      <!-- 
          ** Liste aller Receive Messages       
          -->

      <xsl:for-each select='VoithDiagnosticToolsCAN/CANDeclaration/CanMessage'>

        <xsl:sort select='Name'/>
        <xsl:choose>
          <xsl:when test="not(preceding-sibling::CanMessage = .)">

            <!-- 
          ** Alle Doppelten sind gefiltert -> jetz Ein-Ausblenden der Message-Inhalts-Tabellen         
          -->

            <xsl:if test="ReceiveMessage">

              <tr class='TabBody2'>
                <td  valign="top">
                  <img border="0" src="Resources/XSL/Images/Rxsmall.gif" name="ID_Rx_Grafic"  height="22"/>
                </td>
                <td  valign="top">
                  <xsl:value-of select="Name"/>
                </td>
                <td  valign="top">
                  <xsl:value-of select="Description"/>
                </td>
                <td  valign="top">
                  <xsl:value-of select="@Version"/>
                </td>
                <td  valign="top">
                  <xsl:for-each select='ValidSoftwareVersions'>
                    <xsl:value-of select="."/>
                    <br/>
                  </xsl:for-each>
                </td>                    
                <td>
                  <table border="0" width="100%" id="table100" height="43">
                    <tr>
                      <td width="47" style="vertical-align: middle" height="43">
                        <h1 style="margin-top: 0; margin-bottom: 0; text-align:center">
                          <a href="javascript: void(0)">
                            <xsl:attribute name="onclick">
                              return EP_toggleMeMessageListTable(<xsl:value-of select='concat("ID_Message_Table_",position() )'/>,'<xsl:value-of select='concat("ID_Message_Table_Image_",position())'/>')
                            </xsl:attribute>
                            
                            
                            <img   border="0" src="Resources/XSL/Images/_System_Max.gif" >
                              <xsl:attribute name="name">
                                <xsl:value-of select='concat("ID_Message_Table_Image_",position())'/>
                              </xsl:attribute>
                            </img>

                            </a>
                        </h1>
                      </td>
                      <td style="vertical-align: middle" height="43">
                        <a href="javascript: void(0)">
                          <xsl:attribute name="onclick">
                            return EP_toggleMeMessageListTable(<xsl:value-of select='concat("ID_Message_Table_",position() )'/>,'<xsl:value-of select='concat("ID_Message_Table_Image_",position())'/>')
                          </xsl:attribute>
                          <p class="header" style="margin-top: 0; margin-bottom: 0"/>
                          <script>
                            document.write(' <P class='ueberschrift04'>TabelXX</P>');
                          </script>
                        </a>
                      </td>
                    </tr>
                  </table>
                </td>
              </tr>
              <tr>
                <td colspan='6'>
              <div style="display:none">

                <xsl:attribute name="ID">
                  <xsl:value-of select='concat("ID_Message_Table_",position() )'/>
                       
                </xsl:attribute>


                <hr color="#000099"/>
                <br></br>              
                <br></br>

                <table border="0" margin="0">
                  <tr>
                    <td class="uDocHeader02" width="120"></td>
                    <td class="uDocHeader02">

                      <xsl:attribute name="id">
                        <xsl:value-of select='concat("MessageDef_",ID)'/>
                      </xsl:attribute>
                      <xsl:value-of select='Name'/>

                    </td>

                  </tr>
                </table>

                <!-- 
            ** Transmitter Tabelle **        
            -->

                <table >
                  <tr>
                    
                    <td>
                      <p class="uDocHeader02" style="margin-top: 0; margin-bottom: 0" >
                        <xsl:value-of select="Description"/>
                      </p>
                      <br></br>
                      <table border="0" margin="0">
                        <tr>
                          <td class='TabBorder1' width='180' ></td>
                          <xsl:for-each select='ReceiveMessage/Transmitters'>
                            <TD class='TabBody1' width='180' >
                              <xsl:value-of select="Name"/>
                            </TD>
                          </xsl:for-each>
                        </tr>
                        <tr>
                          <td class='TabBorder1' width='180' >Transmitter:</td>
                          <xsl:for-each select='ReceiveMessage/Transmitters'>
                            <td class='TabBody1' width='180' >
                              <xsl:value-of select="Transmitter"/>
                            </td>
                          </xsl:for-each>
                        </tr>
                        <tr>
                          <td class='TabBorder1' width='180' >Identifier:</td>
                          <xsl:for-each select='ReceiveMessage/Transmitters'>
                            <td class='TabBody1' width='180' >
                              <xsl:value-of select="Identifier/@Value"/>
                              <sub>h</sub>
                              <xsl:value-of select="Identifier"/>
                            </td>
                          </xsl:for-each>
                        </tr>
                        <tr>
                          <td class='TabBorder1' width='180' >PGN:</td>
                          <xsl:for-each select='ReceiveMessage/Transmitters'>
                            <td class='TabBody1' width='180' >
                              <xsl:value-of select="PGN/@ValueHex"/>
                              <sub>h</sub> /   <xsl:value-of select="PGN/@ValueDez"/>
                              <sub>d</sub>
                            </td>
                          </xsl:for-each>
                        </tr>
                        <tr>
                          <td class='TabBorder1' width='180' >Cycle Time:</td>
                          <xsl:for-each select='ReceiveMessage/Transmitters'>
                            <td class='TabBody1' width='180' >
                              <xsl:value-of select="CycleTime"/>
                              <xsl:value-of select="CycleTime/@Unit"/>
                              <xsl:if test='CycleTime/@Alternative'>
                                or  <xsl:value-of select="CycleTime/@Alternative"/>
                              </xsl:if>
                              <xsl:if test='CycleTime/@Additional'>
                                and  <xsl:value-of select="CycleTime/@Additional"/>
                              </xsl:if>
                            </td>
                          </xsl:for-each>
                        </tr>
                        <tr>
                          <td class='TabBorder1' width='180' >Timeout:</td>
                          <xsl:for-each select='ReceiveMessage/Transmitters'>
                            <td class='TabBody1' width='180' >
                              <xsl:value-of select="Timeout"/>
                              <xsl:value-of select="Timeout/@Unit"/>

                            </td>
                          </xsl:for-each>
                        </tr>
                      </table>
                    </td>
                  </tr>

                </table>

                <!-- 
            ** Message Tabelle **        
            -->
                <br></br>
                <br></br>
                <table border="0" margin="0" width ="700">
                  <tr>
                   
                    <td width='40'  class='TabBorder1'>Byte</td>
                    <td width='40'  class='TabBorder1'>Bit</td>
                    <td width='40'  class='TabBorder1'>ECU</td>
                    <td width='200' class='TabBorder1'>Parameters</td>
                    <td width='100' class='TabBorder1'>J1939-71 Ref.</td>
                    <td             class='TabBorder1'>Software Ref.</td>

                  </tr>
                  <xsl:for-each select='ReceiveMessage/ReceiveMessageDefinition/RMD'>
                    <tr>
                     
                      <td class='TabBody1'>
                        <xsl:value-of select="Byte"/>
                      </td>
                      <td class='TabBody1'>
                        <xsl:value-of select="Bit"/>
                      </td>
                      <xsl:choose>
                        <xsl:when test='ECU'>
                          <td class='TabBody1'>
                            <p style="text-align: center">
                              <img SRC="Resources/XSL/Images/_Bulletfilled.gif" alt="Bullet Filled" border ="0"/>
                            </p>
                          </td>
                        </xsl:when>
                        <xsl:otherwise>
                          <td class='TabBody1'>
                            <p style="text-align: center">
                              <img SRC="Resources/XSL/Images/_Bullethollow.gif" alt="Bullet Hollow" border ="0"/>
                            </p>
                          </td>
                        </xsl:otherwise>
                      </xsl:choose>
                      <td class='TabBody1'>
                        <xsl:value-of select="Parameters"/>
                      </td>
                      <td class='TabBody1'>
                        <xsl:value-of select="J1939Ref"/>
                      </td>



                      <xsl:choose>
                        <xsl:when test="IESSoftwareFunction">
                          <td class='TabBody1'>
                            <xsl:value-of select="IESSoftwareFunction"/>
                          </td>
                        </xsl:when>

                        <xsl:when test="SAESoftwareRef">
                          <td class='TabBody1'>
                            <xsl:for-each select="SAESoftwareRef/SAESoftwareRefLink">


                              <a>
                                <xsl:attribute name="href">
                                  #<xsl:value-of select='concat("SRLLinkDef_",@LinkID )'/>
                                  <!-- <xsl:value-of select="Name"/>-->
                                </xsl:attribute>

                                <xsl:value-of select="@LinkID"/>
                              </a>



                            </xsl:for-each>
                          </td>
                        </xsl:when>
                        <xsl:otherwise>
                          <td class='TabBody1'>
                            -
                          </td>
                        </xsl:otherwise>

                      </xsl:choose>


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

                </table>
                <br/>


                <!-- 
            ** Optionaler HTML-Inhalt **        
            -->

                <xsl:if test='OptionalHTML'>
                  <table border="0" margin="0">
                    <tr>
                     
                      <td class="uDocHeader02">

                        <IFRAME name="frame1" width="570" height="260" frameborder="no" border="0" MARGINWIDTH="0" MARGINHEIGHT="0" SCROLLING="yes">
                          <xsl:attribute name="SRC">
                            <xsl:value-of select="OptionalHTML"/>
                          </xsl:attribute>

                        </IFRAME>
                      </td>

                    </tr>

                  </table>
                </xsl:if>


                <br></br>
                <br></br>
                <hr color="#000099"/>
                
            

              </div>
                </td>
              </tr>
              
            </xsl:if>


          </xsl:when>
          <xsl:otherwise>
          </xsl:otherwise>
        </xsl:choose>
      </xsl:for-each>
        
    </table>
    <br/>
    <br/>

    <xsl:for-each select='VoithDiagnosticToolsCAN/CANDeclaration/CanMessage'>

      <xsl:sort select='Name'/>
      <xsl:choose>
        <xsl:when test="not(preceding-sibling::CanMessage = .)">

          <!-- 
          ** Alle Doppelten sind gefiltert          
          -->

          <xsl:if test="ReceiveMessage">
            <xsl:value-of select="Name" /> / <xsl:value-of select="Description" /> /  <xsl:value-of select="@Version" />
            <br/>
          </xsl:if>




        </xsl:when>
        <xsl:otherwise>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:for-each>
    
    
    
    
    
    
    
    <br/>
    <hr color="#000099"/>

  </xsl:template>


  



</xsl:stylesheet>
