source: metadata/trunk/toolkit/xslt/cleanup-xsd.xsl @ 5628

Last change on this file since 5628 was 5628, checked in by Menzo Windhouwer, 10 years ago

Refactoring the toolkit to support CMDI 1.2

  • Property svn:keywords set to
    Date
    Rev
File size: 1.6 KB
Line 
1<?xml version="1.0" encoding="UTF-8"?>
2
3<!--
4    $Rev: 5628 $
5    $Date: 2014-09-15 10:21:49 +0000 (Mon, 15 Sep 2014) $
6-->
7
8<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"
9    xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:dcr="http://www.isocat.org/ns/dcr"
10    xmlns:ann="http://www.clarin.eu">
11    <xsl:strip-space elements="*"/>
12    <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no" />
13
14    <xsl:template match="/xs:schema" mode="clean">
15        <xs:schema xmlns:cmd="http://www.clarin.eu/cmd/">
16            <xsl:copy-of select="@*"/>
17            <!-- Keep the annotation with header information -->
18            <xsl:copy-of select="xs:annotation" />
19            <xsl:apply-templates select="xs:import" mode="clean"/>
20            <!-- Remove double entries for named simpleType and complexType definitions at the begin of the XSD.  -->
21            <xsl:for-each-group select="./xs:simpleType" group-by="@name">
22                <!-- only take the first item -->
23                <xsl:copy-of select="current-group( )[1]"/>
24            </xsl:for-each-group>
25
26            <xsl:for-each-group select="./xs:complexType" group-by="@name">
27                <!-- only take the first item -->
28                <xsl:copy-of select="current-group( )[1]"/>
29            </xsl:for-each-group>
30
31            <xsl:apply-templates select="xs:element" mode="clean"/>
32        </xs:schema>
33    </xsl:template>
34
35
36    <!-- identity copy -->
37    <xsl:template match="@*|node()" mode="clean">
38        <xsl:copy>
39            <xsl:apply-templates select="@*|node()" mode="clean"/>
40        </xsl:copy>
41    </xsl:template>
42
43
44</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.