<?xml version="1.0" encoding="us-ascii"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output doctype-public="-//W3C//DTD HTML 4.01//EN" doctype-system="http://www.w3.org/TR/html4/strict.dtd" encoding="us-ascii"/>
<xsl:strip-space elements="*"/>

<!-- head with style information and body with header and footer -->

<xsl:template match="/">
<html>
<head>
<meta http-equiv="Content-Style-Type" content="text/css"/>
<title>Marlin XML Steering File</title>
<style type="text/css">
h1 { margin:0ex 0em; padding:0.5ex 1em; font-size:x-large; }
h2 { margin:0ex 0em; padding:0.5ex 1em; font-size:large; }
h3 { margin:0ex 0em; padding:0.5ex 1em; font-size:medium; }
h1 { background-color:#000000; color:#FFFFFF; }
div.greenbox &gt; h2, div.greenbox &gt; h3 { background-color:#008000; color:#FFFFFF; }
div.bluebox &gt; h2, div.bluebox &gt; h3 { background-color:#000080; color:#FFFFFF; }
body { padding:2ex 10px; background-color:#E0E0E0; color:#000000; }
div.greenbox { margin:2ex 10px; background-color:#E0FFE0; color:#000000; border:1px solid #008000; }
div.bluebox { margin:2ex 10px; background-color:#E0E0FF; color:#000000; border:1px solid #000080; }
div.parameter { margin:1ex 1em; }
div.parameter + div.parameter { margin-top:-1ex; }
</style>
</head>
<body>
<h1 style="margin:0ex 10px;">Marlin XML Steering File</h1>
<xsl:apply-templates/>
<div style="margin:0ex 10px; font-style:italic; font-size:x-small; text-align:right;">Marlin XSL &#x2014; Adrian Vogel, DESY FLC &#x2014; 2008-05-02</div>
</body>
</html>
</xsl:template>

<!-- block-like elements -->

<xsl:template match="/marlin/execute">
<div class="greenbox">
<h2>Executed Processors</h2>
<xsl:apply-templates/>
</div>
</xsl:template>

<xsl:template match="/marlin/execute//if">
<div class="greenbox">
<xsl:attribute name="style">
<xsl:if test="preceding-sibling::*[1]/attribute::name">margin-top:1ex;</xsl:if>
<xsl:if test="following-sibling::*[1]/attribute::name">margin-bottom:1ex;</xsl:if>
</xsl:attribute>
<h3>if (<xsl:value-of select="normalize-space(@condition)"/>)</h3>
<xsl:apply-templates/>
</div>
</xsl:template>

<xsl:template match="/marlin/global">
<div class="greenbox">
<h2>Global Parameters</h2>
<xsl:apply-templates/>
</div>
</xsl:template>

<xsl:template match="/marlin/group|/marlin/group//group">
<div class="bluebox">
<h2><a><xsl:attribute name="name">group_<xsl:value-of select="normalize-space(@name)"/></xsl:attribute><xsl:value-of select="normalize-space(@name)"/></a><xsl:text> </xsl:text><span style="font-style:italic;">(Group)</span></h2>
<xsl:apply-templates/>
</div>
</xsl:template>

<xsl:template match="/marlin/processor|/marlin/group//processor">
<div class="bluebox">
<h2><a><xsl:attribute name="name">processor_<xsl:value-of select="normalize-space(@name)"/></xsl:attribute><xsl:value-of select="normalize-space(@name)"/></a> (<xsl:value-of select="normalize-space(@type)"/>)</h2>
<xsl:apply-templates/>
</div>
</xsl:template>

<!-- parameter-like elements -->

<xsl:template match="/marlin/execute//group">
<div class="parameter"><a><xsl:attribute name="href">#group_<xsl:value-of select="normalize-space(@name)"/></xsl:attribute><xsl:value-of select="normalize-space(@name)"/></a><xsl:text> </xsl:text><span style="color:#808080; font-style:italic;">(Group)</span></div>
</xsl:template>

<xsl:template match="/marlin/execute//processor">
<div class="parameter"><a><xsl:attribute name="href">#processor_<xsl:value-of select="normalize-space(@name)"/></xsl:attribute><xsl:value-of select="normalize-space(@name)"/></a></div>
</xsl:template>

<xsl:template match="/marlin//parameter">
<div class="parameter">
<xsl:if test="@type"><span style="font-weight:bold;"><xsl:value-of select="normalize-space(@type)"/></span><xsl:text> </xsl:text></xsl:if>
<xsl:value-of select="normalize-space(@name)"/> = <xsl:value-of select="normalize-space(@value)"/><xsl:value-of select="normalize-space()"/>
<xsl:if test="@options"><xsl:text> </xsl:text><span style="color:#808080; font-style:italic;">(options: <xsl:value-of select="normalize-space(@options)"/>)</span></xsl:if>
<xsl:if test="@lcioInType"><xsl:text> </xsl:text><span style="color:#C00000; font-style:italic;">(requires &#x201C;<xsl:value-of select="normalize-space(@lcioInType)"/>&#x201D; collection)</span></xsl:if>
<xsl:if test="@lcioOutType"><xsl:text> </xsl:text><span style="color:#008100; font-style:italic;">(provides &#x201C;<xsl:value-of select="normalize-space(@lcioOutType)"/>&#x201D; collection)</span></xsl:if>
</div>
</xsl:template>

<!-- XML comments -->

<xsl:template match="comment()">
<div class="parameter"><span style="color:#808080; font-style:italic;">// <xsl:value-of select="normalize-space()"/></span></div>
</xsl:template>
  
</xsl:stylesheet>
