VirtualBox

source: vbox/trunk/doc/manual/docbook-refentry-to-manual-dita-pre.xsl

Last change on this file was 99191, checked in by vboxsync, 13 months ago

manual: More work on the refentry to dita converter - I forgot how much fun white space can be... bugref:10302

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.7 KB
Line 
1<?xml version="1.0"?>
2<!--
3 docbook-refentry-to-manual-dita-pre.xsl:
4 XSLT stylesheet for preprocessing a refentry (manpage)
5 before converting it to dita for use in the user manual.
6
7 This just applies remark elements.
8-->
9<!--
10 Copyright (C) 2006-2023 Oracle and/or its affiliates.
11
12 This file is part of VirtualBox base platform packages, as
13 available from https://www.virtualbox.org.
14
15 This program is free software; you can redistribute it and/or
16 modify it under the terms of the GNU General Public License
17 as published by the Free Software Foundation, in version 3 of the
18 License.
19
20 This program is distributed in the hope that it will be useful, but
21 WITHOUT ANY WARRANTY; without even the implied warranty of
22 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23 General Public License for more details.
24
25 You should have received a copy of the GNU General Public License
26 along with this program; if not, see <https://www.gnu.org/licenses>.
27
28 SPDX-License-Identifier: GPL-3.0-only
29-->
30
31<xsl:stylesheet
32 version="1.0"
33 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
34 xmlns:str="http://xsltsl.org/string"
35 >
36
37 <xsl:import href="string.xsl"/>
38
39 <xsl:output method="xml" version="1.0" encoding="utf-8" indent="yes"/>
40 <xsl:preserve-space elements="*"/>
41
42
43<!-- - - - - - - - - - - - - - - - - - - - - - -
44 base operation is to copy everything except for comments.
45 - - - - - - - - - - - - - - - - - - - - - - -->
46
47<xsl:template match="node()|@*">
48 <xsl:copy>
49 <xsl:apply-templates select="node()|@*"/>
50 </xsl:copy>
51</xsl:template>
52
53<xsl:template match="comment()"/>
54
55<!--
56 remark extensions:
57 -->
58<!-- Default: remove all remarks. -->
59<xsl:template match="remark"/>
60
61<!-- help-manual - stuff that should only be included in the manual. -->
62<xsl:template match="remark[@role = 'help-manual']">
63 <xsl:apply-templates/>
64</xsl:template>
65
66<!-- help-copy-synopsis - used in refsect2 to copy synopsis from the refsynopsisdiv. -->
67<xsl:template match="remark[@role = 'help-copy-synopsis']">
68 <xsl:if test="not(parent::refsect2)">
69 <xsl:message terminate="yes">The help-copy-synopsis remark is only applicable in refsect2.</xsl:message>
70 </xsl:if>
71 <xsl:variable name="sSrcId" select="concat('synopsis-',../@id)"/>
72 <xsl:if test="not(/refentry/refsynopsisdiv/cmdsynopsis[@id = $sSrcId])">
73 <xsl:message terminate="yes">Could not find any cmdsynopsis with id=<xsl:value-of select="$sSrcId"/> in refsynopsisdiv.</xsl:message>
74 </xsl:if>
75 <xsl:element name="cmdsynopsis">
76 <xsl:copy-of select="/refentry/refsynopsisdiv/cmdsynopsis[@id = $sSrcId]/node()"/>
77 </xsl:element>
78</xsl:template>
79
80
81</xsl:stylesheet>
82
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use