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