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