Fix typo
[LibreOffice.git] / officecfg / util / schema_trim.xsl
blob41c25990719dad0f703d766fe702289638ef0ca4
1 <?xml version="1.0" encoding="utf-8" standalone="yes" ?> <!-- -*- indent-tabs-mode: nil -*- -->
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>
33 <!-- Remove all comments from the schema files -->
34 <xsl:template match="*|@*">
35 <xsl:copy>
36 <xsl:apply-templates select="*|@*"/>
37 </xsl:copy>
38 </xsl:template>
40 <!-- suppress the location of the schema -->
41 <xsl:template match = "@xsi:schemaLocation"/>
43 <!-- suppress the constraints of the schema
44 <xsl:template match = "constraints"/> -->
46 <!-- suppress all documentation items
47 <xsl:template match = "info"/> -->
49 <!-- suppress constraints for deprecated items -->
50 <xsl:template match = "constraints[../info/deprecated]"/>
52 <!-- suppress all documentation for deprecated items -->
53 <xsl:template match = "desc[../deprecated]"/>
54 <xsl:template match = "label[../deprecated]"/>
56 <!-- copy all other documentation with content -->
57 <xsl:template match="desc|label">
58 <xsl:copy>
59 <xsl:apply-templates select="@*"/>
60 <xsl:value-of select="."/>
61 </xsl:copy>
62 </xsl:template>
64 <!-- suppress all author items -->
65 <xsl:template match = "author"/>
67 <!-- suppress values, which are marked as nil -->
68 <xsl:template match="value[@xsi:nil='true']" />
70 <!-- copy all other values with content -->
71 <xsl:template match="value">
72 <xsl:copy>
73 <xsl:apply-templates select="@*|node()"/>
74 </xsl:copy>
75 </xsl:template>
77 <xsl:template match ="it|unicode">
78 <xsl:copy>
79 <xsl:apply-templates select = "@*|node()"/>
80 </xsl:copy>
81 </xsl:template>
83 <xsl:template match="text()">
84 <xsl:call-template name="replacetwo">
85 <xsl:with-param name="input" select="current()"/>
86 <xsl:with-param name="pattern1" select="'@LIBO_SHARE_FOLDER@'"/>
87 <xsl:with-param name="replace1" select="$LIBO_SHARE_FOLDER"/>
88 <xsl:with-param name="pattern2" select="'@LIBO_SHARE_HELP_FOLDER@'"/>
89 <xsl:with-param name="replace2" select="$LIBO_SHARE_HELP_FOLDER"/>
90 </xsl:call-template>
91 </xsl:template>
93 <xsl:template name="replace">
94 <xsl:param name="input"/>
95 <xsl:param name="pattern"/>
96 <xsl:param name="replace"/>
97 <xsl:choose>
98 <xsl:when test="contains($input, $pattern)">
99 <xsl:value-of select="substring-before($input, $pattern)"/>
100 <xsl:value-of select="$replace"/>
101 <xsl:call-template name="replace">
102 <xsl:with-param name="input" select="substring-after($input, $pattern)"/>
103 <xsl:with-param name="pattern" select="$pattern"/>
104 <xsl:with-param name="replace" select="$replace"/>
105 </xsl:call-template>
106 </xsl:when>
107 <xsl:otherwise>
108 <xsl:value-of select="$input"/>
109 </xsl:otherwise>
110 </xsl:choose>
111 </xsl:template>
113 <xsl:template name="replacetwo">
114 <xsl:param name="input"/>
115 <xsl:param name="pattern1"/>
116 <xsl:param name="replace1"/>
117 <xsl:param name="pattern2"/>
118 <xsl:param name="replace2"/>
119 <xsl:choose>
120 <xsl:when test="contains($input, $pattern1)">
121 <xsl:call-template name="replace">
122 <xsl:with-param name="input" select="substring-before($input, $pattern1)"/>
123 <xsl:with-param name="pattern" select="$pattern2"/>
124 <xsl:with-param name="replace" select="$replace2"/>
125 </xsl:call-template>
126 <xsl:value-of select="$replace1"/>
127 <xsl:call-template name="replacetwo">
128 <xsl:with-param name="input" select="substring-after($input, $pattern1)"/>
129 <xsl:with-param name="pattern1" select="$pattern1"/>
130 <xsl:with-param name="replace1" select="$replace1"/>
131 <xsl:with-param name="pattern2" select="$pattern2"/>
132 <xsl:with-param name="replace2" select="$replace2"/>
133 </xsl:call-template>
134 </xsl:when>
135 <xsl:otherwise>
136 <xsl:call-template name="replace">
137 <xsl:with-param name="input" select="$input"/>
138 <xsl:with-param name="pattern" select="$pattern2"/>
139 <xsl:with-param name="replace" select="$replace2"/>
140 </xsl:call-template>
141 </xsl:otherwise>
142 </xsl:choose>
143 </xsl:template>
145 </xsl:transform>