VirtualBox

source: vbox/trunk/doc/manual/docbook-refentry-to-H-help.xsl@ 78203

Last change on this file since 78203 was 73276, checked in by vboxsync, 6 years ago

doc/manual: Big build system overhaul, because the use of entities and catalogs eliminates the need to have placeholders in XML which previously needed separate preprocessing. Many cleanups, including replacing almost all pattern rules (since their dependencies had to be too generous) and using defines instead. Also integrated many cleanups for the user manual text (which needs careful review, couldn't check yet if it uses any additional tags which some of our XSLT would ignore).

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
  • Property svn:mergeinfo set to (toggle deleted branches)
    /branches/VBox-3.0/doc/manual/docbook-refentry-to-manual-overview.xsl58652,​70973
    /branches/VBox-3.2/doc/manual/docbook-refentry-to-manual-overview.xsl66309,​66318
    /branches/VBox-4.0/doc/manual/docbook-refentry-to-manual-overview.xsl70873
    /branches/VBox-4.1/doc/manual/docbook-refentry-to-manual-overview.xsl74233,​78414,​78691,​82579,​85941,​85944-85947,​85949-85950,​85953,​86701,​86728,​87009
    /branches/VBox-4.2/doc/manual/docbook-refentry-to-manual-overview.xsl82653,​86229-86230,​86234,​86529,​91503-91504,​91506-91508,​91510,​91514-91515,​91521
    /branches/VBox-4.3/doc/manual/docbook-refentry-to-manual-overview.xsl91223,​94066,​94839,​94897,​95154,​95164,​95167,​95295,​95338,​95353-95354,​95356,​95367,​95451,​95475,​95477,​95480,​95507,​95640,​95659,​95661,​95663,​98913-98915,​99358
    /branches/VBox-4.3/trunk/doc/manual/docbook-refentry-to-manual-overview.xsl91223
    /branches/andy/draganddrop/doc/manual/docbook-refentry-to-manual-overview.xsl90781-91268
    /branches/andy/guestctrl20/doc/manual/docbook-refentry-to-manual-overview.xsl78916,​78930
    /branches/andy/pdmaudio/doc/manual/docbook-refentry-to-manual-overview.xsl94582,​94641,​94654,​94688,​94778,​94783,​94816,​95197,​95215-95216,​95250,​95279,​95505-95506,​95543,​95694,​96323,​96470-96471,​96582,​96587,​96802-96803,​96817,​96904,​96967,​96999,​97020-97021,​97025,​97050,​97099
    /branches/bird/hardenedwindows/doc/manual/docbook-refentry-to-manual-overview.xsl92692-94610
    /branches/dsen/gui/doc/manual/docbook-refentry-to-manual-overview.xsl79076-79078,​79089,​79109-79110,​79112-79113,​79127-79130,​79134,​79141,​79151,​79155,​79157-79159,​79193,​79197
    /branches/dsen/gui2/doc/manual/docbook-refentry-to-manual-overview.xsl79224,​79228,​79233,​79235,​79258,​79262-79263,​79273,​79341,​79345,​79354,​79357,​79387-79388,​79559-79569,​79572-79573,​79578,​79581-79582,​79590-79591,​79598-79599,​79602-79603,​79605-79606,​79632,​79635,​79637,​79644
    /branches/dsen/gui3/doc/manual/docbook-refentry-to-manual-overview.xsl79645-79692
    /trunk/src/doc/manual/docbook-refentry-to-manual-overview.xsl92342
File size: 5.6 KB
Line 
1<?xml version="1.0"?>
2<!--
3 docbook-refentry-to-H-help.xsl:
4 XSLT stylesheet for generating command and sub-command
5 constants header for the built-in help.
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="text" version="1.0" encoding="utf-8" indent="yes"/>
27 <xsl:strip-space elements="*"/>
28
29 <xsl:param name="g_sMode" select="not-specified"/>
30
31
32 <!-- Default action, do nothing. -->
33 <xsl:template match="node()|@*"/>
34
35 <!--
36 Generate SCOPE enum for a refentry. We convert the
37 cmdsynopsisdiv/cmdsynopsis IDs into constants.
38 -->
39 <xsl:template match="refentry">
40 <xsl:variable name="RefEntry" select="."/>
41 <xsl:variable name="sRefEntryId" select="@id"/>
42 <xsl:variable name="sBaseNm">
43 <xsl:choose>
44 <xsl:when test="contains($sRefEntryId, '-')"> <!-- Multi level command. -->
45 <xsl:call-template name="str:to-upper">
46 <xsl:with-param name="text" select="translate(substring-after($sRefEntryId, '-'), '-', '_')"/>
47 </xsl:call-template>
48 </xsl:when>
49 <xsl:otherwise> <!-- Simple command. -->
50 <xsl:call-template name="str:to-upper">
51 <xsl:with-param name="text" select="translate($sRefEntryId, '-', '_')"/>
52 </xsl:call-template>
53 </xsl:otherwise>
54 </xsl:choose>
55 </xsl:variable>
56
57 <xsl:choose>
58 <!-- Generate subcommand enums and defines -->
59 <xsl:when test="$g_sMode = 'subcmd'">
60 <!-- Start enum type and start off with the refentry id. -->
61 <xsl:text>
62enum
63{
64#define HELP_SCOPE_</xsl:text>
65 <xsl:value-of select="$sBaseNm"/>
66 <xsl:value-of select="substring(' ',1,56 - string-length($sBaseNm) - 11)"/>
67 <xsl:text> RT_BIT_32(HELP_SCOPE_</xsl:text><xsl:value-of select="$sBaseNm"/><xsl:text>_BIT)
68 HELP_SCOPE_</xsl:text><xsl:value-of select="$sBaseNm"/><xsl:text>_BIT = 0</xsl:text>
69
70 <!-- Synopsis IDs -->
71 <xsl:for-each select="./refsynopsisdiv/cmdsynopsis[@id != concat('synopsis-', $sRefEntryId)]">
72 <xsl:variable name="sSubNm">
73 <xsl:text>HELP_SCOPE_</xsl:text>
74 <xsl:call-template name="str:to-upper">
75 <xsl:with-param name="text" select="translate(substring-after(substring-after(@id, '-'), '-'), '-', '_')"/>
76 </xsl:call-template>
77 </xsl:variable>
78 <xsl:text>,
79#define </xsl:text>
80 <xsl:value-of select="$sSubNm"/>
81 <xsl:value-of select="substring(' ',1,56 - string-length($sSubNm))"/>
82 <xsl:text> RT_BIT_32(</xsl:text><xsl:value-of select="$sSubNm"/><xsl:text>_BIT)
83 </xsl:text>
84 <xsl:value-of select="$sSubNm"/><xsl:text>_BIT</xsl:text>
85 </xsl:for-each>
86
87 <!-- Add scoping info for refsect1, refsect2 and refsect3 IDs that aren't part of the synopsis. -->
88 <xsl:for-each select=".//refsect1[@id] | .//refsect2[@id] | .//refsect3[@id]">
89 <xsl:variable name="sThisId" select="@id"/>
90 <xsl:if test="not($RefEntry[@id = $sThisId]) and not($RefEntry/refsynopsisdiv/cmdsynopsis[@id = concat('synopsis-', $sThisId)])">
91 <xsl:variable name="sSubNm">
92 <xsl:text>HELP_SCOPE_</xsl:text>
93 <xsl:choose>
94 <xsl:when test="contains($sRefEntryId, '-')"> <!-- Multi level command. -->
95 <xsl:call-template name="str:to-upper">
96 <xsl:with-param name="text" select="translate(substring-after(@id, '-'), '-', '_')"/>
97 </xsl:call-template>
98 </xsl:when>
99 <xsl:otherwise> <!-- Simple command. -->
100 <xsl:call-template name="str:to-upper">
101 <xsl:with-param name="text" select="translate(@id, '-', '_')"/>
102 </xsl:call-template>
103 </xsl:otherwise>
104 </xsl:choose>
105 </xsl:variable>
106 <xsl:text>,
107#define </xsl:text>
108 <xsl:value-of select="$sSubNm"/>
109 <xsl:value-of select="substring(' ',1,56 - string-length($sSubNm))"/>
110 <xsl:text> RT_BIT_32(</xsl:text><xsl:value-of select="$sSubNm"/><xsl:text>_BIT)
111 </xsl:text>
112 <xsl:value-of select="$sSubNm"/><xsl:text>_BIT</xsl:text>
113 </xsl:if>
114 </xsl:for-each>
115
116 <!-- Done - complete the enum. -->
117 <xsl:text>,
118 HELP_SCOPE_</xsl:text><xsl:value-of select="$sBaseNm"/><xsl:text>_END
119};
120</xsl:text>
121 </xsl:when>
122
123 <!-- Generate command enum value. -->
124 <xsl:when test="$g_sMode = 'cmd'">
125 <xsl:text> HELP_CMD_</xsl:text><xsl:value-of select="$sBaseNm"/><xsl:text>,
126</xsl:text>
127 </xsl:when>
128
129 <!-- Shouldn't happen. -->
130 <xsl:otherwise>
131 <xsl:message terminate="yes">Bad or missing g_sMode string parameter value.</xsl:message>
132 </xsl:otherwise>
133 </xsl:choose>
134 </xsl:template>
135
136</xsl:stylesheet>
137
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use