1cdf0e10cSrcweir<?xml version="1.0" encoding="UTF-8"?> 2*85596f7bSAndrew Rist<!--*********************************************************** 3*85596f7bSAndrew Rist * 4*85596f7bSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 5*85596f7bSAndrew Rist * or more contributor license agreements. See the NOTICE file 6*85596f7bSAndrew Rist * distributed with this work for additional information 7*85596f7bSAndrew Rist * regarding copyright ownership. The ASF licenses this file 8*85596f7bSAndrew Rist * to you under the Apache License, Version 2.0 (the 9*85596f7bSAndrew Rist * "License"); you may not use this file except in compliance 10*85596f7bSAndrew Rist * with the License. You may obtain a copy of the License at 11*85596f7bSAndrew Rist * 12*85596f7bSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 13*85596f7bSAndrew Rist * 14*85596f7bSAndrew Rist * Unless required by applicable law or agreed to in writing, 15*85596f7bSAndrew Rist * software distributed under the License is distributed on an 16*85596f7bSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17*85596f7bSAndrew Rist * KIND, either express or implied. See the License for the 18*85596f7bSAndrew Rist * specific language governing permissions and limitations 19*85596f7bSAndrew Rist * under the License. 20*85596f7bSAndrew Rist * 21*85596f7bSAndrew Rist ***********************************************************--> 22*85596f7bSAndrew Rist 23*85596f7bSAndrew Rist 24cdf0e10cSrcweir 25cdf0e10cSrcweir<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 26cdf0e10cSrcweir xmlns:oor="http://openoffice.org/2001/registry"> 27cdf0e10cSrcweir <xsl:param name="prefix"/> 28cdf0e10cSrcweir <xsl:strip-space elements="*"/> 29cdf0e10cSrcweir <xsl:preserve-space elements="value it"/> 30cdf0e10cSrcweir <!-- TODO: strip space from "value" elements that have "it" children --> 31cdf0e10cSrcweir <xsl:template match="/"> 32cdf0e10cSrcweir <oor:data xmlns:xs="http://www.w3.org/2001/XMLSchema" 33cdf0e10cSrcweir xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 34cdf0e10cSrcweir <xsl:copy-of select="list/dependency"/> 35cdf0e10cSrcweir<!-- 36cdf0e10cSrcweir <xsl:copy-of select="document(list/filename)/oor:component-schema"/> 37cdf0e10cSrcweir <xsl:copy-of select="document(list/filename)/oor:component-data"/> 38cdf0e10cSrcweir 39cdf0e10cSrcweir instead of the below for-each would only issue warnings, not errors, for 40cdf0e10cSrcweir non-existing or otherwise bad input files; it is important that the input 41cdf0e10cSrcweir filename list is already sorted in an order suitable for the configmgr 42cdf0e10cSrcweir (e.g., xcs files preceeding xcu files). 43cdf0e10cSrcweir--> 44cdf0e10cSrcweir <xsl:for-each select="list/filename"> 45cdf0e10cSrcweir <xsl:variable name="doc" select="document(concat($prefix, .))"/> 46cdf0e10cSrcweir <xsl:choose> 47cdf0e10cSrcweir <xsl:when test="count($doc/oor:component-schema) = 1"> 48cdf0e10cSrcweir <xsl:apply-templates select="$doc/oor:component-schema"/> 49cdf0e10cSrcweir </xsl:when> 50cdf0e10cSrcweir <xsl:when test="count($doc/oor:component-data) = 1"> 51cdf0e10cSrcweir <xsl:apply-templates select="$doc/oor:component-data"/> 52cdf0e10cSrcweir </xsl:when> 53cdf0e10cSrcweir <xsl:otherwise> 54cdf0e10cSrcweir <xsl:message terminate="yes"> 55cdf0e10cSrcweir <xsl:text>cannot process </xsl:text> 56cdf0e10cSrcweir <xsl:value-of select="."/> 57cdf0e10cSrcweir </xsl:message> 58cdf0e10cSrcweir </xsl:otherwise> 59cdf0e10cSrcweir </xsl:choose> 60cdf0e10cSrcweir </xsl:for-each> 61cdf0e10cSrcweir </oor:data> 62cdf0e10cSrcweir </xsl:template> 63cdf0e10cSrcweir <xsl:template 64cdf0e10cSrcweir match="oor:component-schema|oor:component-data|templates|component|group| 65cdf0e10cSrcweir set|node-ref|prop|item|value|it|unicode|node"> 66cdf0e10cSrcweir <xsl:copy copy-namespaces="no"> 67cdf0e10cSrcweir <!-- prune oor:component-data xmlns:install="..." namespaces (would only 68cdf0e10cSrcweir work in XSLT 2.0, however) --> 69cdf0e10cSrcweir <xsl:apply-templates select="@*"/> 70cdf0e10cSrcweir <xsl:apply-templates/> 71cdf0e10cSrcweir </xsl:copy> 72cdf0e10cSrcweir </xsl:template> 73cdf0e10cSrcweir <xsl:template match="value[it]"> 74cdf0e10cSrcweir <xsl:copy copy-namespaces="no"> 75cdf0e10cSrcweir <xsl:apply-templates select="@*"/> 76cdf0e10cSrcweir <xsl:apply-templates select="*"/> 77cdf0e10cSrcweir <!-- ignore text elements (which must be whitespace only) --> 78cdf0e10cSrcweir </xsl:copy> 79cdf0e10cSrcweir </xsl:template> 80cdf0e10cSrcweir <xsl:template match="info|import|uses|constraints"/> 81cdf0e10cSrcweir <!-- TODO: no longer strip elements when they are eventually read by 82cdf0e10cSrcweir configmgr implementation --> 83cdf0e10cSrcweir <xsl:template match="@*"> 84cdf0e10cSrcweir <xsl:copy/> 85cdf0e10cSrcweir </xsl:template> 86cdf0e10cSrcweir</xsl:stylesheet> 87