<?xml version="1.0" encoding="iso-8859-1" standalone="yes"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:key name="Warnungen" 
             match="/Anleitung/Maschinenmodell/Zustand" 
             use="Übergang[Warnung]/@oper" />
    <xsl:output method="html"/>
    <xsl:template match="/">
      <dl>
       	<xsl:apply-templates mode="M1"/>
      </dl>
    </xsl:template>
    <xsl:template match="text()" priority="-1" mode="M1"/>
    <xsl:template match="Handlung/Aufforderung" priority="4000" mode="M1">
      <xsl:variable name="oper" select="@oper"/>
      <xsl:variable name="handlung" select="../Ziel"/>
      <xsl:variable name="warnhinweise" select="../Warnhinweis"/>
      <xsl:for-each select="key('Warnungen',$oper)">
	<xsl:variable name="zustand" select="@id"/>
	<xsl:if test="count($warnhinweise[@zust=$zustand]) = 0">
	  <dt><xsl:apply-templates select="$handlung"/></dt>
	  <dd>Operation "<xsl:value-of select="$oper"/>": 
	      Problem möglich mit Zustand "<xsl:value-of select="@id"/>":
          <br />
	    <xsl:apply-templates 
                select='Übergang[@oper=$oper]/Warnung'/>
	  </dd>
        </xsl:if>
      </xsl:for-each>
      <xsl:apply-templates mode="M1"/>
    </xsl:template>
</xsl:stylesheet>



