<?xml version="1.0" encoding="Shift_JIS"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl" >
  <xsl:template match="/">
    <html>
      <header>
        <TITLE>XMLによる状態遷移表</TITLE>
      </header>
      <body>
        <hr/>
        <xsl:for-each select="FSM">
          <h1><xsl:value-of select="@name"/> の状態遷移</h1>
          <p><i><xsl:value-of select="Note"/></i></p>
          <table>
            <tr>
              <th align="left">初期状態</th>
              <td><font color="blue"><xsl:value-of select="@initial"/></font></td>
            </tr>
            <tr>
              <th align="left">停止状態</th>
              <td><font color="blue"><xsl:value-of select="@terminal"/></font></td>
            </tr>
          </table>
          <ul>Java source<p/>
            <font color="gray">
            <li><xsl:value-of select="@package"/>.<xsl:value-of select="@name"/>.Context.java</li>
            <li><xsl:value-of select="@package"/>.<xsl:value-of select="@name"/>.State.java</li>
            <li><xsl:value-of select="@package"/>.<xsl:value-of select="@name"/>.FSM.java</li>
            </font>
          </ul>
          <ul>C++ source<p/>
            <font color="gray">
            <li><xsl:value-of select="@name"/>.h</li>
            <li><xsl:value-of select="@name"/>.cpp</li>
            </font>
          </ul>

          <ol>
          <xsl:for-each select="State">
            <li>状態 : <font color="blue"><xsl:value-of select="@name"/></font>
            <p><i><xsl:value-of select="Note"/></i></p>
            <p>
            <ul>
              <li>入場動作 : <font color="red"><xsl:value-of select="@enter"/></font></li>
              <li>退場動作 : <font color="red"><xsl:value-of select="@exit"/></font></li>
            </ul>
            </p>
            <p>
            <table border="2">
            <tr>
              <th>イベント</th>
              <th>アクション</th>
              <th>遷移先</th>
              <th>説明</th>
            </tr>
            <xsl:for-each select="Event" >
              <tr>
                <td><font color="green"><xsl:value-of select="@name"/></font></td>
                <td><font color="red"><xsl:value-of select="@action"/></font></td>
                <td><font color="blue"><xsl:value-of select="@transition"/></font></td>
                <td><i><xsl:value-of select="Note"/></i></td>
              </tr>
            </xsl:for-each>
            </table>
            </p>
            </li>
          </xsl:for-each>
          </ol>
          <p/>
          <p>※ 遷移先が空欄である場合、状態の変化がなく、入場/退場動作も行わないことを意味します</p>
          <hr/>
        </xsl:for-each>
      </body>
    </html>
  </xsl:template>
</xsl:stylesheet>

