1 | <?xml version="1.0"?>
|
---|
2 | <!--
|
---|
3 | docbook-refentry-to-manual-sect1.xsl:
|
---|
4 | XSLT stylesheet for transforming a refentry (manpage)
|
---|
5 | to a sect1 for the user manual.
|
---|
6 |
|
---|
7 | Copyright (C) 2006-2015 Oracle Corporation
|
---|
8 |
|
---|
9 | This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | available from http://www.virtualbox.org. This file is free software;
|
---|
11 | you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | General Public License (GPL) as published by the Free Software
|
---|
13 | Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | -->
|
---|
17 |
|
---|
18 | <xsl:stylesheet
|
---|
19 | version="1.0"
|
---|
20 | xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
---|
21 | xmlns:str="http://xsltsl.org/string"
|
---|
22 | >
|
---|
23 |
|
---|
24 | <xsl:import href="string.xsl"/>
|
---|
25 |
|
---|
26 | <xsl:output method="xml" version="1.0" encoding="utf-8" indent="yes"/>
|
---|
27 | <xsl:strip-space elements="*"/>
|
---|
28 |
|
---|
29 |
|
---|
30 | <!-- - - - - - - - - - - - - - - - - - - - - - -
|
---|
31 | global XSLT variables
|
---|
32 | - - - - - - - - - - - - - - - - - - - - - - -->
|
---|
33 |
|
---|
34 |
|
---|
35 |
|
---|
36 | <!-- - - - - - - - - - - - - - - - - - - - - - -
|
---|
37 | base operation is to copy.
|
---|
38 | - - - - - - - - - - - - - - - - - - - - - - -->
|
---|
39 |
|
---|
40 | <xsl:template match="node()|@*">
|
---|
41 | <xsl:copy>
|
---|
42 | <xsl:apply-templates select="node()|@*"/>
|
---|
43 | </xsl:copy>
|
---|
44 | </xsl:template>
|
---|
45 |
|
---|
46 |
|
---|
47 | <!-- - - - - - - - - - - - - - - - - - - - - - -
|
---|
48 |
|
---|
49 | - - - - - - - - - - - - - - - - - - - - - - -->
|
---|
50 |
|
---|
51 | <!-- rename refentry to sect1 -->
|
---|
52 | <xsl:template match="refentry">
|
---|
53 | <sect1>
|
---|
54 | <xsl:apply-templates select="node()|@*"/>
|
---|
55 | </sect1>
|
---|
56 | </xsl:template>
|
---|
57 |
|
---|
58 | <!-- Remove refentryinfo, keeping the title element. -->
|
---|
59 | <xsl:template match="refentryinfo">
|
---|
60 | <xsl:if test="./title">
|
---|
61 | <xsl:copy-of select="./title"/>
|
---|
62 | </xsl:if>
|
---|
63 | </xsl:template>
|
---|
64 |
|
---|
65 | <!-- Morph refnamediv into a brief description. -->
|
---|
66 | <xsl:template match="refnamediv">
|
---|
67 | <para>
|
---|
68 | <xsl:call-template name="capitalize">
|
---|
69 | <xsl:with-param name="text" select="normalize-space(./refpurpose)"/>
|
---|
70 | </xsl:call-template>
|
---|
71 | <xsl:text>.</xsl:text>
|
---|
72 | </para>
|
---|
73 | </xsl:template>
|
---|
74 |
|
---|
75 | <!-- Remove refmeta. -->
|
---|
76 | <xsl:template match="refmeta"/>
|
---|
77 |
|
---|
78 | <!-- Remove all remarks (for now). -->
|
---|
79 | <xsl:template match="remark"/>
|
---|
80 |
|
---|
81 |
|
---|
82 | <!--
|
---|
83 | Captializes the given text.
|
---|
84 | -->
|
---|
85 | <xsl:template name="capitalize">
|
---|
86 | <xsl:param name="text"/>
|
---|
87 | <xsl:call-template name="str:to-upper">
|
---|
88 | <xsl:with-param name="text" select="substring($text,1,1)"/>
|
---|
89 | </xsl:call-template>
|
---|
90 | <xsl:value-of select="substring($text,2)"/>
|
---|
91 | </xsl:template>
|
---|
92 |
|
---|
93 | </xsl:stylesheet>
|
---|
94 |
|
---|