1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168
|
<?xml version="1.0" encoding="ASCII"?>
<!--
Purpose:
Add a wrapper div around procedures, so the title can be left-aligned while
everything else in the procedure gets a little border on the left and thus
is padded a bit more.
Also make sure, variablelist entries can be linked to.
Author(s): Thomas Schraitle <toms@opensuse.org>,
Stefan Knorr <sknorr@suse.de>, Janina Setz <jsetz@suse.com>
Copyright: 2012, 2016, Thomas Schraitle, Stefan Knorr, Janina Setz
-->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:exsl="http://exslt.org/common"
xmlns="http://www.w3.org/1999/xhtml"
exclude-result-prefixes="exsl">
<xsl:template match="varlistentry">
<dt>
<xsl:call-template name="id.attribute">
<xsl:with-param name="force" select="1"/>
</xsl:call-template>
<xsl:apply-templates select="term"/>
<xsl:choose>
<xsl:when test="(@id or @xml:id)">
<xsl:text> </xsl:text>
<xsl:call-template name="create.permalink">
<xsl:with-param name="object" select="."/>
</xsl:call-template>
</xsl:when>
</xsl:choose>
</dt>
<dd>
<xsl:apply-templates select="listitem"/>
</dd>
</xsl:template>
<xsl:template match="procedure">
<!-- Preserve order of PIs and comments -->
<xsl:variable name="preamble"
select="*[not(self::step
or self::title
or self::titleabbrev)]
|comment()[not(preceding-sibling::step)]
|processing-instruction()[not(preceding-sibling::step)]"/>
<div>
<xsl:call-template name="common.html.attributes"/>
<xsl:call-template name="id.attribute">
<xsl:with-param name="conditional">
<xsl:choose>
<xsl:when test="title">0</xsl:when>
<xsl:otherwise>1</xsl:otherwise>
</xsl:choose>
</xsl:with-param>
</xsl:call-template>
<xsl:if test="(title or info/title)">
<xsl:call-template name="formal.object.heading"/>
</xsl:if>
<div class="procedure-contents">
<xsl:apply-templates select="$preamble"/>
<xsl:choose>
<xsl:when test="count(step) = 1">
<ul>
<xsl:call-template name="generate.class.attribute"/>
<xsl:apply-templates
select="step
|comment()[preceding-sibling::step]
|processing-instruction()[preceding-sibling::step]"/>
</ul>
</xsl:when>
<xsl:otherwise>
<ol>
<xsl:call-template name="generate.class.attribute"/>
<xsl:attribute name="type">
<xsl:value-of select="substring($procedure.step.numeration.formats,1,1)"/>
</xsl:attribute>
<xsl:apply-templates
select="step
|comment()[preceding-sibling::step]
|processing-instruction()[preceding-sibling::step]"/>
</ol>
</xsl:otherwise>
</xsl:choose>
</div>
</div>
</xsl:template>
<!-- Handle step performance="optional" -->
<!-- For the common case, where there is a para as the first item within step,
we handle this in the para template further down. For the much less common
case of "anything else" (e.g. a list as first element), we handle this
directly in the step template. -->
<xsl:template match="step">
<li>
<xsl:call-template name="common.html.attributes"/>
<xsl:call-template name="id.attribute"/>
<xsl:call-template name="anchor"/>
<xsl:if test="@performance='optional'
and *[1][local-name()!='para' and local-name()!='simpara']">
<p class="step-optional">
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="'step.optional'"/>
</xsl:call-template>
</p>
</xsl:if>
<xsl:apply-templates/>
</li>
</xsl:template>
<xsl:template match="step/*[1][local-name()='para' or local-name()='simpara']">
<xsl:call-template name="paragraph">
<xsl:with-param name="class">
<xsl:if test="@role and $para.propagates.style != 0">
<xsl:value-of select="@role"/>
</xsl:if>
</xsl:with-param>
<xsl:with-param name="content">
<xsl:if test="position() = 1 and parent::listitem">
<xsl:call-template name="anchor">
<xsl:with-param name="node" select="parent::listitem"/>
</xsl:call-template>
</xsl:if>
<xsl:call-template name="anchor"/>
<xsl:if test="../@performance='optional'">
<span class="step-optional">
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="'step.optional'"/>
</xsl:call-template>
</span>
<xsl:text> </xsl:text>
</xsl:if>
<xsl:apply-templates/>
</xsl:with-param>
</xsl:call-template>
</xsl:template>
<xsl:template match="listitem/simpara" priority="10">
<!-- Unlike the original DocBook stylesheets, if a listitem contains only a
single simpara, we still want to output the <p> wrapper... This is essentially
a copy of the match="para" template. -->
<xsl:call-template name="paragraph">
<xsl:with-param name="class">
<xsl:if test="@role and $para.propagates.style != 0">
<xsl:value-of select="@role"/>
</xsl:if>
</xsl:with-param>
<xsl:with-param name="content">
<xsl:if test="position() = 1 and parent::d:listitem">
<xsl:call-template name="anchor">
<xsl:with-param name="node" select="parent::d:listitem"/>
</xsl:call-template>
</xsl:if>
<xsl:call-template name="anchor"/>
<xsl:apply-templates/>
</xsl:with-param>
</xsl:call-template>
</xsl:template>
</xsl:stylesheet>
|