Version 6.4.0.0.beta1, tag libreoffice-6.4.0.0.beta1
[LibreOffice.git] / officecfg / util / schema_trim.xsl
blobf67d89194a51db876ad615f99400a7c215706f3f
1 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
2 <!--
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 -->
20 <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
21 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
22 xmlns:xs="http://www.w3.org/2001/XMLSchema"
23 xmlns:oor="http://openoffice.org/2001/registry"
24 version="1.0">
26 <xsl:param name="LIBO_SHARE_FOLDER"/>
27 <xsl:param name="LIBO_SHARE_HELP_FOLDER"/>
29 <!-- Get the correct format -->
30 <xsl:output method="xml" indent="yes"/>
31 <xsl:namespace-alias stylesheet-prefix="xs" result-prefix="xs"></xsl:namespace-alias>
34 <!-- Remove all comments from the schema files -->
35 <xsl:template match="*|@*">
36 <xsl:copy>
37 <xsl:apply-templates select="*|@*"/>
38 </xsl:copy>
39 </xsl:template>
41 <!-- suppress the location of the schema -->
42 <xsl:template match = "@xsi:schemaLocation"/>
44 <!-- suppress the constraints of the schema
45 <xsl:template match = "constraints"/> -->
47 <!-- suppress all documentation items
48 <xsl:template match = "info"/> -->
50 <!-- suppress constraints for deprecated items -->
51 <xsl:template match = "constraints[../info/deprecated]"/>
53 <!-- suppress all documentation for deprecated items -->
54 <xsl:template match = "desc[../deprecated]"/>
55 <xsl:template match = "label[../deprecated]"/>
57 <!-- copy all other documentation with content -->
58 <xsl:template match="desc|label">
59 <xsl:copy>
60 <xsl:apply-templates select="@*"/>
61 <xsl:value-of select="."/>
62 </xsl:copy>
63 </xsl:template>
65 <!-- suppress all author items -->
66 <xsl:template match = "author"/>
68 <!-- suppress values, which are marked as nil -->
69 <xsl:template match="value[@xsi:nil='true']" />
71 <!-- copy all other values with content -->
72 <xsl:template match="value">
73 <xsl:copy>
74 <xsl:apply-templates select="@*|node()"/>
75 </xsl:copy>
76 </xsl:template>
78 <xsl:template match ="it|unicode">
79 <xsl:copy>
80 <xsl:apply-templates select = "@*|node()"/>
81 </xsl:copy>
82 </xsl:template>
84 <xsl:template match="text()">
85 <xsl:call-template name="replacetwo">
86 <xsl:with-param name="input" select="current()"/>
87 <xsl:with-param name="pattern1" select="'@LIBO_SHARE_FOLDER@'"/>
88 <xsl:with-param name="replace1" select="$LIBO_SHARE_FOLDER"/>
89 <xsl:with-param name="pattern2" select="'@LIBO_SHARE_HELP_FOLDER@'"/>
90 <xsl:with-param name="replace2" select="$LIBO_SHARE_HELP_FOLDER"/>
91 </xsl:call-template>
92 </xsl:template>
94 <xsl:template name="replace">
95 <xsl:param name="input"/>
96 <xsl:param name="pattern"/>
97 <xsl:param name="replace"/>
98 <xsl:choose>
99 <xsl:when test="contains($input, $pattern)">
100 <xsl:value-of select="substring-before($input, $pattern)"/>
101 <xsl:value-of select="$replace"/>
102 <xsl:call-template name="replace">
103 <xsl:with-param
104 name="input" select="substring-after($input, $pattern)"/>
105 <xsl:with-param name="pattern" select="$pattern"/>
106 <xsl:with-param name="replace" select="$replace"/>
107 </xsl:call-template>
108 </xsl:when>
109 <xsl:otherwise>
110 <xsl:value-of select="$input"/>
111 </xsl:otherwise>
112 </xsl:choose>
113 </xsl:template>
115 <xsl:template name="replacetwo">
116 <xsl:param name="input"/>
117 <xsl:param name="pattern1"/>
118 <xsl:param name="replace1"/>
119 <xsl:param name="pattern2"/>
120 <xsl:param name="replace2"/>
121 <xsl:choose>
122 <xsl:when test="contains($input, $pattern1)">
123 <xsl:call-template name="replace">
124 <xsl:with-param
125 name="input" select="substring-before($input, $pattern1)"/>
126 <xsl:with-param name="pattern" select="$pattern2"/>
127 <xsl:with-param name="replace" select="$replace2"/>
128 </xsl:call-template>
129 <xsl:value-of select="$replace1"/>
130 <xsl:call-template name="replacetwo">
131 <xsl:with-param
132 name="input" select="substring-after($input, $pattern1)"/>
133 <xsl:with-param name="pattern1" select="$pattern1"/>
134 <xsl:with-param name="replace1" select="$replace1"/>
135 <xsl:with-param name="pattern2" select="$pattern2"/>
136 <xsl:with-param name="replace2" select="$replace2"/>
137 </xsl:call-template>
138 </xsl:when>
139 <xsl:otherwise>
140 <xsl:call-template name="replace">
141 <xsl:with-param
142 name="input" select="$input"/>
143 <xsl:with-param name="pattern" select="$pattern2"/>
144 <xsl:with-param name="replace" select="$replace2"/>
145 </xsl:call-template>
146 </xsl:otherwise>
147 </xsl:choose>
148 </xsl:template>
150 </xsl:transform>