<!-- <options version="1.0"> --><!--  <object name="Model"> -->
<!--    <properties> -->
<!--      <property name="Name" /> -->
<!--    </properties> -->
<!--    <children> -->
<!--      <object name="Model Subset"> -->
<!--        <properties> -->
<!--          <property name="Name" /> -->
<!--          <property name="Attached Tables" /> -->
<!--        </properties> -->
<!--        <children> -->
<!--          <object name="Diagram"> -->
<!--            <properties> -->
<!--              <property name="Name" /> -->
<!--            </properties> -->
<!--            <children> -->
<!--              <object name="Table Graphics"> -->
<!--                <properties> -->
<!--                  <property name="Name" /> -->
<!--                  <property name="Model Object" /> -->
<!--                </properties> -->
<!--              </object> -->
<!--            </children> -->
<!--          </object> -->
<!--        </children> -->
<!--      </object> -->
<!--      <object name="Table"> -->
<!--        <properties> -->
<!--          <property name="Name" /> -->
<!--        </properties> -->
<!--      </object> -->
<!--      <object name="Table Graphics Domain"> -->
<!--        <properties> -->
<!--          <property name="Name" /> -->
<!--        </properties> -->
<!--      </object> -->
<!--    </children> -->
<!--  </object> -->
<!-- </options> -->


<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

  <xsl:output method="html"/>

  <xsl:template match="/">

<HTML>
<HEAD>
<TITLE>Model Exception Report</TITLE>

    <style>
      body {
        background-color: #ffffff;
        font: bold 16px arial;
      }
      table.main {
        border-collapse: collapse;
        border: 0px solid black;
      }
      table
      {
        border-collapse: collapse; border: 1px solid black;
        font: italic small-caps 8px arial;
      }

      th {
        background-color:blue;
        padding: 10px;
        font: small-caps bold 16px arial;
        color: white;
        text-align:left;
        border: 0px;
      }

      td {
        vertical-align: top;
        padding: 10px;
        font: small-caps 12px arial;
      }

      div.reference {
        background-color: #ff860d;
        position:relative;
        width:10px;
        height:10px;
        display: inline;
        margin-right: 5px;
      }
      div.definition {
        background-color: green;
        position:relative;
        width:10px;
        height:10px;
        display: inline;
        margin-right: 5px;
      }
      div.header {
        width:100%;
        border: 1px solid blue;
        background-color: lightblue;
        padding-left: 20px;
      }


      H1   { border-bottom: #000099 thick solid; }
      img { border-width: 0px; }
      .sqlcode
      {
      font-family: system;
      font-size: 70%;
      }
      .CommonHeader
      {
      color: #666666;
      font-size: 130%;
      font-weight: bold;
      font-family: Tahoma, Arial, Helvetica;
      padding: 0px;
      margin: 0px;
      margin-top: 8px;
      }
      a:link, a:visited
      {
      color: #4444BF;
      text-decoration: none;
      }

      .header-table, .header-table TD, .header-table TH
      {
      background-color: #92B2F2;
      color: black;
      border-width: 0px;
      font-family:sans-serif;
      font-weight:600;
      vertical-align:middle;
      font-size: 16px;
      font-variant: normal;
      width:100%;
      }

      .TablesHeader
      {
      color: white;
      background-color: #000099;
      }
      .TableHeading
      {
      border-bottom: #000099 solid;
      }
      pre
      {
      border: solid 1px #666666;
      background-color: #f2f2f2;
      }
      .pre
      {
      border: solid 1px #666666;
      background-color: #f2f2f2;
      }
      pre2
      {
      border: solid 1px #666666;
      background-color: #f2f2f2;
      }

    </style>
</HEAD>
<BODY>
    <table cellpadding="10px" class="header-table" style="border-width: 5; border-color: #000099; border-style:solid;">
      <tr>
        <td style="padding-left: 100px; font-size:110%">
          The purpose of this report is to identify which tables do not appear on any model. The report is intended to be used as a cross check when reverse engineering a model to insure all table have been repesented in the diagrams.<br/>
        </td>
        <td style="padding-right: 50px;">
          <img src="images/ModelRight.gif" align="right" height="100px"/>
        </td>
      </tr>
    </table>
    <br/>
          <table border="1">
            <tr>
              <th>
                Tables not represented in any Diagrams
              </th>
            </tr>
            <xsl:apply-templates select="/model/model-children/table" mode="exceptions"/>
          </table>

</BODY>
</HTML>
  </xsl:template>

  <xsl:template match="/model/model-children/table" mode="exceptions">
    <xsl:variable name="id" select="@id"/>
    <xsl:if test="count(/model/model-children/model-subset/model-subset-children/diagram[diagram-children/table-graphics/table-graphics-properties/table-graphics.model-object/@reference-id=$id])&lt;1">
      <xsl:call-template name="table">
        <xsl:with-param name="id" select="$id"/>
        <xsl:with-param name="mode" select="'exceptions'"/>
      </xsl:call-template>
    </xsl:if>
  </xsl:template>

  <xsl:template name="table">
    <xsl:param name="id"/>
    <xsl:param name="mode"/>
    <tr>
      <td nowrap="nowrap">
      <xsl:value-of select="table-properties/table.name" />
      </td>
      <xsl:if test="$mode='used'">
      <td>
      <xsl:apply-templates select="/model/model-children/model-subset/model-subset-children/diagram/diagram-children/table-graphics[table-graphics-properties/table-graphics.model-object/@reference-id=$id]" />
      </td>
      </xsl:if>
    </tr>
  </xsl:template>

  <xsl:template match="/model/model-children/model-subset/model-subset-children/diagram/diagram-children/table-graphics">

      <div class="reference">
      <xsl:if test="@inherits-from=/model/model-children/table-graphics-domain[not(@inherits-from)]/@id">
        <xsl:attribute name="class">
          <xsl:text>definition</xsl:text>
        </xsl:attribute>
      </xsl:if>
      </div>
    <xsl:value-of select="../../diagram-properties/diagram.name" /><br/>
  </xsl:template>




</xsl:stylesheet>
