Changeset 3192 for trunk/lib/docbook


Ignore:
Timestamp:
Mar 13, 2007, 4:27:06 PM (15 years ago)
Author:
Martin Svensson
Message:

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:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/docbook/preprocess/preprocess.xsl

    r3153 r3192  
    11<?xml version='1.0'?>
    2 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    3                 version='1.0'>
     2<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version='1.0'>
    43
    5 <xsl:param name="remove.images.width" select="'1'" />
    6 <xsl:param name="conditionals"        select="''"  />
    7 <xsl:variable name="normalized"       select="concat(' ',normalize-space($conditionals),' ')"/>
    8                
    9 <!--
    10     Paste an image
    11     @element      pasteFigure
    12     @attribute    id                The id of this figure will be a concatenation of 'figure:' and the id.
    13                                     If not defined, the file name (without last 4 characters - extension)
    14                                     is used as an id.
    15     @attribute    src               Filename (wuthout path) to be used to load the figure.
    16     @attribute    width             (optional) image width.
     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),' ')" />
    177
    18     @global       remove.images.width If not '0', width attribute is ignored
    19 -->
    20 <xsl:template match="pasteFigure">
    21     <figure>
    22       <xsl:attribute name="id">
    23         <xsl:if test="@id">
    24             <xsl:value-of select="concat('figure:',@id)" />
    25         </xsl:if>
    26         <xsl:if test="not(@id)">
    27             <xsl:value-of select="concat('figure:',substring(@src, 0,string-length(@src)-3))" />
    28         </xsl:if>
    29       </xsl:attribute>
    30       <title><xsl:apply-templates /></title>
    31       <mediaobject>
    32         <imageobject>
    33           <imagedata fileref="{concat('figures/',@src)}"
    34                      format="{translate(substring(@src,string-length(@src)-2),'qwertyuioplkjhgfdsazxcvbnm','QWERTYUIOPLKJHGFDSAZXCVBNM')}"
    35                      align="center">
    36           <xsl:if test="$remove.images.width='0' and @width">
    37             <xsl:attribute name="width"><xsl:value-of select="@width"/></xsl:attribute>
    38           </xsl:if>
    39           </imagedata>
    40         </imageobject>
    41         <textobject><phrase><xsl:apply-templates select=".//text()" /></phrase></textobject>
    42       </mediaobject>
    43     </figure>
    44 </xsl:template>
     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>
    4553
    4654
    47 <!-- Include another file -->
     55  <!-- Include another file -->
    4856
    49 <xsl:template match="include">
    50     <xsl:apply-templates select="document(@file,.)" />
    51 </xsl:template>
     57  <xsl:template match="include">
     58    <xsl:apply-templates select="document(@file,.)" />
     59  </xsl:template>
    5260
    5361
    54 <!-- Conditional rendering -->
     62  <!-- Conditional rendering -->
    5563
    56 <xsl:template match="ifdefined">
    57     <xsl:if test="contains($normalized,concat(' ',normalize-space(@value),' '))">
    58         <xsl:apply-templates />
    59     </xsl:if>
    60 </xsl:template>
     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>
    6173
    62 <!-- Copy all unrecognized elements -->
     74  <!-- Copy all unrecognized elements -->
    6375
    64 <xsl:template match="*|text()|processing-instruction()">
    65     <xsl:copy><xsl:copy-of select="@*" /><xsl:apply-templates /></xsl:copy>
    66 </xsl:template>
     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>
    6782
    6883
Note: See TracChangeset for help on using the changeset viewer.