<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	
<xsl:template match="/">

  <html>
    <body>
      <xsl:apply-templates />
    </body>
  </html>

</xsl:template>



<!-- ###################################################################### -->
<!-- ### ZMSContainerObject                                                 -->
<!-- ###################################################################### -->
<xsl:template match="ZMS|ZMSRubrik|ZMSDocument">

  <xsl:for-each select="title/lang">
    <h1>
      <xsl:apply-templates />
    </h1>
  </xsl:for-each>
  
  <!-- Process child-nodes -->
  <xsl:apply-templates select="*[substring(name(),1,3)='ZMS']"/>
  
</xsl:template>



<!-- ###################################################################### -->
<!-- ### ZMSTextarea                                                        -->
<!-- ###################################################################### -->
<xsl:template match="ZMSTextarea">

  <!-- Format -->
  <xsl:variable name="format">
    <xsl:choose>
      <xsl:when test="format='headline_1'">h1</xsl:when>
      <xsl:when test="format='headline_2'">h2</xsl:when>
      <xsl:when test="format='headline_3'">h3</xsl:when>
      <xsl:when test="format='headline_4'">h4</xsl:when>
      <xsl:when test="format='headline_5'">h5</xsl:when>
      <xsl:when test="format='headline_6'">h6</xsl:when>
      <xsl:when test="format='indented_block'">blockquote</xsl:when>
      <xsl:when test="format='emphasis'">em</xsl:when>
      <xsl:otherwise>p</xsl:otherwise>
    </xsl:choose>
  </xsl:variable>

  <!-- Text -->
  <xsl:element name="{$format}">
    <xsl:for-each select="text/lang">
      <xsl:apply-templates />
    </xsl:for-each>
  </xsl:element>

</xsl:template>



<!-- ###################################################################### -->
<!-- ### ZMSGraphic                                                         -->
<!-- ###################################################################### -->
<xsl:template match="ZMSGraphic">

  <xsl:for-each select="img/lang/data">
    <img>
      <xsl:attribute name="src">
        <xsl:value-of select="@filename"/>
      </xsl:attribute>
    </img>
  </xsl:for-each>

</xsl:template>



<!-- ###################################################################### -->
<!-- ### HTML-Tags                                                          -->
<!-- ###################################################################### -->
<xsl:template match="a|table|tr|td|th">
  <xsl:copy-of select="."/>
</xsl:template>



</xsl:stylesheet>

