source: trunk/lib/docbook/preprocess/preprocess.xsl @ 3192

Last change on this file since 3192 was 3192, checked in by Martin Svensson, 15 years ago

Changed the DOCTYPE in each xml-file of documentation to use the local version of dweiss-docbook-extensions.dtd
that's located in base2/lib/docbook/preprocess.
Added a stylesheet tag in preprocess.xsl that copies the text inside the helptexttag.
Also formatted the preprocess file with source format tool in eclipse.

File size: 2.4 KB
Line 
1<?xml version='1.0'?>
2<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version='1.0'>
3
4  <xsl:param name="remove.images.width" select="'1'" />
5  <xsl:param name="conditionals" select="''" />
6  <xsl:variable name="normalized" select="concat(' ',normalize-space($conditionals),' ')" />
7
8  <!--
9    Paste an image
10    @element      pasteFigure
11    @attribute    id                The id of this figure will be a concatenation of 'figure:' and the id.
12    If not defined, the file name (without last 4 characters - extension)
13    is used as an id.
14    @attribute    src               Filename (wuthout path) to be used to load the figure.
15    @attribute    width             (optional) image width.
16   
17    @global       remove.images.width If not '0', width attribute is ignored
18  -->
19  <xsl:template match="pasteFigure">
20    <figure>
21      <xsl:attribute name="id">
22        <xsl:if test="@id">
23          <xsl:value-of select="concat('figure:',@id)" />
24        </xsl:if>
25        <xsl:if test="not(@id)">
26          <xsl:value-of
27            select="concat('figure:',substring(@src, 0,string-length(@src)-3))" />
28        </xsl:if>
29      </xsl:attribute>
30      <title>
31        <xsl:apply-templates />
32      </title>
33      <mediaobject>
34        <imageobject>
35          <imagedata fileref="{concat('figures/',@src)}"
36            format="{translate(substring(@src,string-length(@src)-2),'qwertyuioplkjhgfdsazxcvbnm','QWERTYUIOPLKJHGFDSAZXCVBNM')}"
37            align="center">
38            <xsl:if test="$remove.images.width='0' and @width">
39              <xsl:attribute name="width">
40                <xsl:value-of select="@width" />
41              </xsl:attribute>
42            </xsl:if>
43          </imagedata>
44        </imageobject>
45        <textobject>
46          <phrase>
47            <xsl:apply-templates select=".//text()" />
48          </phrase>
49        </textobject>
50      </mediaobject>
51    </figure>
52  </xsl:template>
53
54
55  <!-- Include another file -->
56
57  <xsl:template match="include">
58    <xsl:apply-templates select="document(@file,.)" />
59  </xsl:template>
60
61
62  <!-- Conditional rendering -->
63
64  <xsl:template match="ifdefined">
65    <xsl:if test="contains($normalized,concat(' ',normalize-space(@value),' '))">
66      <xsl:apply-templates />
67    </xsl:if>
68  </xsl:template>
69 
70  <xsl:template match="helptext">
71    <xsl:apply-templates/>
72  </xsl:template>
73
74  <!-- Copy all unrecognized elements -->
75
76  <xsl:template match="*|text()|processing-instruction()">
77    <xsl:copy>
78      <xsl:copy-of select="@*" />
79      <xsl:apply-templates />
80    </xsl:copy>
81  </xsl:template>
82
83
84</xsl:stylesheet>
85
86
Note: See TracBrowser for help on using the repository browser.