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