<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

  <xsl:template match="/">
    <html>
    <body style='font-family:sans-serif'>
      <xsl:apply-templates select="flowModel"/>
    </body>
    </html>
  </xsl:template>

  <xsl:template match="flowModel">
      <h3>Summary of workflow <xsl:value-of select="@name"/></h3>
      <br></br>
      <xsl:if test="serviceProvider">
        <h3>Service Providers</h3>
        <table bgcolor="#dddddd"  border='1'>
        <tr><th>name</th><th span='2'>locator</th></tr>
        <xsl:apply-templates select="serviceProvider"/>
        </table>
      </xsl:if>

      <xsl:if test="activity">
        <h3>Activities</h3>
        <table bgcolor="#dd00dd"  border='1'>
        <tr><th>name</th><th>service</th><th>operation</th><th>portType</th></tr>
        <xsl:apply-templates select="activity"/>
        </table>
      </xsl:if>


      <xsl:if test="dataLink">
        <h3>Data Links</h3>
        <table bgcolor="#33dddd"  border='1'>
        <tr><th>source</th><th>target</th><th>source Msg</th><th>target Msg</th></tr>
        <xsl:apply-templates select="dataLink"/>
        </table>
      </xsl:if>

      <xsl:if test="controlLink">
        <h3>Control Links</h3>
        <table bgcolor="#33dddd"  border='1'>
        <tr><th>source</th><th>target</th></tr>
        <xsl:apply-templates select="controlLink"/>
        </table>
      </xsl:if>

  </xsl:template>

  <xsl:template match="serviceProvider">
  <tr>
  <td style="font-size:smaller"><xsl:value-of select="@name"/></td>
  <xsl:apply-templates select="locator"/>
  </tr>
  </xsl:template>

  <xsl:template match="locator">
  <td style="font-size:smaller"><xsl:value-of select="@service"/></td>
  <td style="font-size:smaller"><xsl:value-of select="@type"/></td>
  </xsl:template>

  <xsl:template match="activity">
  <tr>
  <td style="font-size:smaller"><xsl:value-of select="@name"/></td>
  <xsl:apply-templates select="performedBy"/>
  <xsl:apply-templates select="implement"/>
  </tr>
  </xsl:template>

  <xsl:template match="performedBy">
  <td style="font-size:smaller"><xsl:value-of select="@serviceProvider"/></td>
  </xsl:template>

  <xsl:template match="implement">
      <xsl:if test="export">
        <xsl:apply-templates select="export"/>
      </xsl:if>
  </xsl:template>

  <xsl:template match="export">
      <xsl:if test="target">
        <xsl:apply-templates select="target"/>
      </xsl:if>
  </xsl:template>

  <xsl:template match="target">
  <td style="font-size:smaller"><xsl:value-of select="@operation"/></td>
  <td style="font-size:smaller"><xsl:value-of select="@portType"/></td>
  </xsl:template>

  <xsl:template match="dataLink">
  <tr>
  <td style="font-size:smaller"><xsl:value-of select="@source"/></td>
  <td style="font-size:smaller"><xsl:value-of select="@target"/></td>
      <xsl:if test="map">
        <xsl:apply-templates select="map"/>
      </xsl:if>  </tr>
  </xsl:template>

  <xsl:template match="map">
  <td style="font-size:smaller"><xsl:value-of select="@sourceMessage"/></td>
  <td style="font-size:smaller"><xsl:value-of select="@targetMessage"/></td>
  </xsl:template>

 <xsl:template match="controlLink">
  <tr>
  <td style="font-size:smaller"><xsl:value-of select="@source"/></td>
  <td style="font-size:smaller"><xsl:value-of select="@target"/></td>
  </tr>
  </xsl:template>

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

</xsl:stylesheet>
