xref: /aoo4110/main/officecfg/util/resource.xsl (revision b1cdbd2c)
1<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
2<!--***********************************************************
3 *
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements.  See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership.  The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License.  You may obtain a copy of the License at
11 *
12 *   http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied.  See the License for the
18 * specific language governing permissions and limitations
19 * under the License.
20 *
21 ***********************************************************-->
22
23
24
25<xsl:transform  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
26		xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
27		xmlns:xs="http://www.w3.org/2001/XMLSchema"
28		xmlns:oor="http://openoffice.org/2001/registry"
29		version="1.0">
30
31    <!-- Set correct output format -->
32    <xsl:output method="text" indent="no" encoding="UTF-8"/>
33
34    <xsl:param name="locale"/>
35    <xsl:param name="fallback-locale">en-US</xsl:param>
36
37    <xsl:namespace-alias stylesheet-prefix="xs" result-prefix="xs"></xsl:namespace-alias>
38
39    <!-- overwrite default rule for text & attribute nodes to be silent -->
40    <xsl:template match="text()|@*">
41    </xsl:template>
42
43    <!-- match root -->
44    <xsl:template match="/">
45        <xsl:apply-templates/>
46    </xsl:template>
47
48    <!-- match all elements that could possibly contain info elements -->
49    <xsl:template match="info/desc[@xml:lang=$locale]|info/label[@xml:lang=$locale]">
50
51        <!-- print TPF's path to current node -->
52        <xsl:for-each select="ancestor-or-self::*">
53            <xsl:if test="local-name(.)!='component-schema'"><xsl:value-of select="local-name(.)"/>
54                <xsl:choose>
55                    <xsl:when test="@oor:name">[<xsl:value-of select="@oor:name"/>]</xsl:when>
56                    <xsl:when test="@oor:value">[<xsl:value-of select="@oor:value"/>]</xsl:when>
57                </xsl:choose>
58                <xsl:if test="position()!=last()">.</xsl:if>
59            </xsl:if>
60        </xsl:for-each>
61
62        <!-- print separator (equals sign) -->
63        <xsl:text>=</xsl:text>
64
65        <!-- print info/desc|label element's content -->
66        <xsl:value-of select="normalize-space(.)"/>
67
68        <!-- print linefeed -->
69        <xsl:text>&#10;</xsl:text>
70
71        <xsl:apply-templates/>
72
73    </xsl:template>
74
75</xsl:transform>
76