-Werror=maybe-uninitialized
[LibreOffice.git] / solenv / bin / packregistry.xslt
blob9079bbc6b43d636e5dfa5f6d4c2fbcdee2331b31
1 <?xml version="1.0" encoding="UTF-8"?>
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 -->
19 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
20 xmlns:oor="http://openoffice.org/2001/registry">
21 <xsl:param name="prefix"/>
22 <xsl:strip-space elements="*"/>
23 <xsl:preserve-space elements="value it"/>
24 <!-- TODO: strip space from "value" elements that have "it" children -->
25 <xsl:template match="/">
26 <oor:data xmlns:xs="http://www.w3.org/2001/XMLSchema"
27 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
28 <xsl:copy-of select="list/dependency"/>
29 <!--
30 <xsl:copy-of select="document(list/filename)/oor:component-schema"/>
31 <xsl:copy-of select="document(list/filename)/oor:component-data"/>
33 instead of the below for-each would only issue warnings, not errors, for
34 non-existing or otherwise bad input files; it is important that the input
35 filename list is already sorted in an order suitable for the configmgr
36 (e.g., xcs files preceding xcu files).
37 -->
38 <xsl:for-each select="list/filename">
39 <xsl:variable name="doc" select="document(concat($prefix, .))"/>
40 <xsl:choose>
41 <xsl:when test="count($doc/oor:component-schema) = 1">
42 <xsl:apply-templates select="$doc/oor:component-schema"/>
43 </xsl:when>
44 <xsl:when test="count($doc/oor:component-data) = 1">
45 <xsl:apply-templates select="$doc/oor:component-data"/>
46 </xsl:when>
47 <xsl:otherwise>
48 <xsl:message terminate="yes">
49 <xsl:text>cannot process </xsl:text>
50 <xsl:value-of select="."/>
51 </xsl:message>
52 </xsl:otherwise>
53 </xsl:choose>
54 </xsl:for-each>
55 </oor:data>
56 </xsl:template>
57 <xsl:template
58 match="oor:component-schema|oor:component-data|templates|component|group|
59 set|node-ref|prop|item|value|it|unicode|node">
60 <xsl:copy copy-namespaces="no">
61 <!-- prune oor:component-data xmlns:install="..." namespaces (would only
62 work in XSLT 2.0, however) -->
63 <xsl:apply-templates select="@*"/>
64 <xsl:apply-templates/>
65 </xsl:copy>
66 </xsl:template>
67 <xsl:template match="value[it]">
68 <xsl:copy copy-namespaces="no">
69 <xsl:apply-templates select="@*"/>
70 <xsl:apply-templates select="*"/>
71 <!-- ignore text elements (which must be whitespace only) -->
72 </xsl:copy>
73 </xsl:template>
74 <xsl:template match="info|import|uses|constraints"/>
75 <!-- TODO: no longer strip elements when they are eventually read by
76 configmgr implementation -->
77 <xsl:template match="@*">
78 <xsl:copy/>
79 </xsl:template>
80 </xsl:stylesheet>