blob: df0b99f8585669e6d8ee07f2f34c1f4d4c17cb61 [file] [log] [blame]
<?xml version="1.0"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!-- SVN $Id$ -->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:param name="isfaq"/>
<xsl:template match="document">
<xsl:if test="normalize-space(header/title)!=''">
<h1>
<xsl:value-of select="header/title"/>
</h1>
</xsl:if>
<xsl:if test="normalize-space(header/subtitle)!=''">
<h3>
<xsl:value-of select="header/subtitle"/>
</h3>
</xsl:if>
<xsl:if test="header/authors">
<p>
<font size="-2">
<xsl:for-each select="header/authors/person">
<xsl:choose>
<xsl:when test="position()=1">by&#160;</xsl:when>
<xsl:otherwise>,&#160;</xsl:otherwise>
</xsl:choose>
<xsl:value-of select="@name"/>
</xsl:for-each>
</font>
</p>
</xsl:if>
<xsl:apply-templates select="body"/>
</xsl:template>
<xsl:template match="body">
<xsl:apply-templates/>
</xsl:template>
<!-- section handling
- <a name/> anchors are added if the id attribute is specified
- generated anchors are still included for TOC - what should we do about this?
- FIXME: provide a generic facility to process section irrelevant to their
nesting depth
-->
<xsl:template match="section">
<xsl:if test="title">
<h3>
<xsl:value-of select="title"/>
</h3>
</xsl:if>
<xsl:apply-templates select="*[not(self::title)]"/>
</xsl:template>
<xsl:template match="section/section">
<a name="{generate-id()}"/>
<xsl:if test="normalize-space(@id)!=''">
<a name="{@id}"/>
</xsl:if>
<h4>
<xsl:value-of select="title"/>
</h4>
<xsl:apply-templates select="*[not(self::title)]"/>
</xsl:template>
<xsl:template match="note | warning | fixme">
<div class="frame {local-name()}">
<div class="label">
<xsl:choose>
<xsl:when test="local-name() = 'note'">Note</xsl:when>
<xsl:when test="local-name() = 'warning'">Warning</xsl:when>
<xsl:otherwise>Fixme (
<xsl:value-of select="@author"/>
)</xsl:otherwise>
</xsl:choose>
</div>
<div class="content">
<xsl:apply-templates/>
</div>
</div>
</xsl:template>
<xsl:template match="link">
<a href="{@href}">
<xsl:apply-templates/>
</a>
</xsl:template>
<xsl:template match="jump">
<a href="{@href}" target="_top">
<xsl:apply-templates/>
</a>
</xsl:template>
<xsl:template match="fork">
<a href="{@href}" target="_blank">
<xsl:apply-templates/>
</a>
</xsl:template>
<xsl:template match="source">
<pre class="code">
<xsl:apply-templates/>
</pre>
</xsl:template>
<xsl:template match="anchor">
<a name="{@id}"/>
</xsl:template>
<xsl:template match="icon">
<img src="{@src}" alt="{@alt}">
<xsl:if test="@height">
<xsl:attribute name="height"><xsl:value-of select="@height"/></xsl:attribute>
</xsl:if>
<xsl:if test="@width">
<xsl:attribute name="width"><xsl:value-of select="@width"/></xsl:attribute>
</xsl:if>
</img>
</xsl:template>
<xsl:template match="figure">
<div align="center">
<img src="{@src}" alt="{@alt}" class="figure">
<xsl:if test="@height">
<xsl:attribute name="height"><xsl:value-of select="@height"/></xsl:attribute>
</xsl:if>
<xsl:if test="@width">
<xsl:attribute name="width"><xsl:value-of select="@width"/></xsl:attribute>
</xsl:if>
</img>
</div>
</xsl:template>
<xsl:template match="table">
<table class="table" cellpadding="4" cellspacing="1">
<xsl:apply-templates/>
</table>
</xsl:template>
<xsl:template match="node()|@*" priority="-1">
<xsl:copy>
<xsl:apply-templates select="@*"/>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>