1 | <?xml version="1.0"?>
|
---|
2 | <!--
|
---|
3 | docbook-refentry-to-manpage-preprocessing.xsl:
|
---|
4 | XSLT stylesheet preprocessing remarks elements before
|
---|
5 | turning a refentry (manpage) into a unix manual page and
|
---|
6 | VBoxManage built-in help.
|
---|
7 |
|
---|
8 | Copyright (C) 2006-2015 Oracle Corporation
|
---|
9 |
|
---|
10 | This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
11 | available from http://www.virtualbox.org. This file is free software;
|
---|
12 | you can redistribute it and/or modify it under the terms of the GNU
|
---|
13 | General Public License (GPL) as published by the Free Software
|
---|
14 | Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
15 | VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
16 | hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
17 | -->
|
---|
18 |
|
---|
19 | <xsl:stylesheet
|
---|
20 | version="1.0"
|
---|
21 | xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
---|
22 | xmlns:str="http://xsltsl.org/string"
|
---|
23 | >
|
---|
24 |
|
---|
25 | <xsl:output method="xml" version="1.0" encoding="utf-8" indent="no"/>
|
---|
26 |
|
---|
27 | <!--
|
---|
28 | The default action is to copy everything.
|
---|
29 | -->
|
---|
30 | <xsl:template match="node()|@*">
|
---|
31 | <xsl:copy>
|
---|
32 | <xsl:apply-templates select="node()|@*"/>
|
---|
33 | </xsl:copy>
|
---|
34 | </xsl:template>
|
---|
35 |
|
---|
36 | <!--
|
---|
37 | Execute synopsis copy remark (avoids duplication for complicated xml).
|
---|
38 | We strip the attributes off it.
|
---|
39 | -->
|
---|
40 | <xsl:template match="remark[@role = 'help-copy-synopsis']">
|
---|
41 | <xsl:choose>
|
---|
42 | <xsl:when test="parent::refsect2"/>
|
---|
43 | <xsl:otherwise>
|
---|
44 | <xsl:message terminate="yes">Misplaced remark/@role=help-copy-synopsis element.
|
---|
45 | Only supported on: refsect2</xsl:message>
|
---|
46 | </xsl:otherwise>
|
---|
47 | </xsl:choose>
|
---|
48 | <xsl:variable name="sSrcId">
|
---|
49 | <xsl:choose>
|
---|
50 | <xsl:when test="@condition"><xsl:value-of select="concat('synopsis-', @condition)"/></xsl:when>
|
---|
51 | <xsl:otherwise><xsl:value-of select="concat('synopsis-', ../@id)"/></xsl:otherwise>
|
---|
52 | </xsl:choose>
|
---|
53 | </xsl:variable>
|
---|
54 | <xsl:variable name="CmdSynopsis" select="/refentry/refsynopsisdiv/cmdsynopsis[@id = $sSrcId]"/>
|
---|
55 | <xsl:if test="not($CmdSynopsis)">
|
---|
56 | <xsl:message terminate="yes">Could not find any cmdsynopsis with id=<xsl:value-of select="$sSrcId"/> in refsynopsisdiv.</xsl:message>
|
---|
57 | </xsl:if>
|
---|
58 |
|
---|
59 | <xsl:element name="cmdsynopsis">
|
---|
60 | <xsl:apply-templates select="$CmdSynopsis/node()"/>
|
---|
61 | </xsl:element>
|
---|
62 |
|
---|
63 | </xsl:template>
|
---|
64 |
|
---|
65 | <!--
|
---|
66 | Remove bits only intended for the manual.
|
---|
67 | -->
|
---|
68 | <xsl:template match="remark[@role='help-manual']"/>
|
---|
69 |
|
---|
70 | <!--
|
---|
71 | Remove remarks without a role.
|
---|
72 | These are used for leaving questions and such while working with the documentation team.
|
---|
73 | -->
|
---|
74 | <xsl:template match="remark[not(@role)]"/>
|
---|
75 |
|
---|
76 |
|
---|
77 | </xsl:stylesheet>
|
---|
78 |
|
---|