xref: /aoo41x/main/officecfg/util/resource.xsl (revision cdf0e10c)
1<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
2<!--***********************************************************************
3 *
4  DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5
6  Copyright 2000, 2010 Oracle and/or its affiliates.
7
8  OpenOffice.org - a multi-platform office productivity suite
9
10  This file is part of OpenOffice.org.
11
12  OpenOffice.org is free software: you can redistribute it and/or modify
13  it under the terms of the GNU Lesser General Public License version 3
14  only, as published by the Free Software Foundation.
15
16  OpenOffice.org is distributed in the hope that it will be useful,
17  but WITHOUT ANY WARRANTY; without even the implied warranty of
18  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  GNU Lesser General Public License version 3 for more details
20  (a copy is included in the LICENSE file that accompanied this code).
21
22  You should have received a copy of the GNU Lesser General Public License
23  version 3 along with OpenOffice.org.  If not, see
24  <http://www.openoffice.org/license.html>
25  for a copy of the LGPLv3 License.
26
27 ************************************************************************ -->
28
29<xsl:transform  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
30		xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
31		xmlns:xs="http://www.w3.org/2001/XMLSchema"
32		xmlns:oor="http://openoffice.org/2001/registry"
33		version="1.0">
34
35    <!-- Set correct output format -->
36    <xsl:output method="text" indent="no" encoding="UTF-8"/>
37
38    <xsl:param name="locale"/>
39    <xsl:param name="fallback-locale">en-US</xsl:param>
40
41    <xsl:namespace-alias stylesheet-prefix="xs" result-prefix="xs"></xsl:namespace-alias>
42
43    <!-- overwrite default rule for text & attribute nodes to be silent -->
44    <xsl:template match="text()|@*">
45    </xsl:template>
46
47    <!-- match root -->
48    <xsl:template match="/">
49        <xsl:apply-templates/>
50    </xsl:template>
51
52    <!-- match all elements that could possibly contain info elements -->
53    <xsl:template match="info/desc[@xml:lang=$locale]|info/label[@xml:lang=$locale]">
54
55        <!-- print TPF's path to current node -->
56        <xsl:for-each select="ancestor-or-self::*">
57            <xsl:if test="local-name(.)!='component-schema'"><xsl:value-of select="local-name(.)"/>
58                <xsl:choose>
59                    <xsl:when test="@oor:name">[<xsl:value-of select="@oor:name"/>]</xsl:when>
60                    <xsl:when test="@oor:value">[<xsl:value-of select="@oor:value"/>]</xsl:when>
61                </xsl:choose>
62                <xsl:if test="position()!=last()">.</xsl:if>
63            </xsl:if>
64        </xsl:for-each>
65
66        <!-- print separator (equals sign) -->
67        <xsl:text>=</xsl:text>
68
69        <!-- print info/desc|label element's content -->
70        <xsl:value-of select="normalize-space(.)"/>
71
72        <!-- print linefeed -->
73        <xsl:text>&#10;</xsl:text>
74
75        <xsl:apply-templates/>
76
77    </xsl:template>
78
79</xsl:transform>
80