Last change
on this file since 1164 was
1164,
checked in by mwindhouwer, 13 years ago
|
added upgrade_to_cmdi-v1_1.xsl
- stylesheet to upgrade a CMDI instance document from version 1.0 to version 1.1 by
-- adding the CMD default namespace http://www.clarin.eu/cmd/
-- adding the CMDVersion attribute to the CMD root element and set it to 1.1
-- transforming an xsi:noNamespaceSchemaLocation to xsi:schemaLocation
|
File size:
1.3 KB
|
Line | |
---|
1 | <?xml version="1.0" encoding="UTF-8"?> |
---|
2 | <xsl:stylesheet |
---|
3 | xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" |
---|
4 | xmlns="http://www.clarin.eu/cmd/" |
---|
5 | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> |
---|
6 | |
---|
7 | <xsl:variable name="CMDVersion" select="'1.1'"/> |
---|
8 | |
---|
9 | <!-- identity template for attributes and text nodes --> |
---|
10 | <xsl:template match="@*|text()"> |
---|
11 | <xsl:copy/> |
---|
12 | </xsl:template> |
---|
13 | |
---|
14 | <!-- add the default CMD namespace and the new version attribute to the root element --> |
---|
15 | <xsl:template match="CMD"> |
---|
16 | <CMD xmlns="http://www.clarin.eu/cmd/" CMDVersion="{$CMDVersion}"> |
---|
17 | <xsl:apply-templates select="@*|node()"/> |
---|
18 | </CMD> |
---|
19 | </xsl:template> |
---|
20 | |
---|
21 | <!-- rewrite @xsi:npNamespaceSchemaLocation --> |
---|
22 | <xsl:template match="CMD/@xsi:noNamespaceSchemaLocation"> |
---|
23 | <xsl:attribute name="xsi:schemaLocation"> |
---|
24 | <xsl:text>http://www.clarin.eu/cmd/</xsl:text> |
---|
25 | <xsl:text> </xsl:text> |
---|
26 | <xsl:value-of select="."/> |
---|
27 | </xsl:attribute> |
---|
28 | </xsl:template> |
---|
29 | |
---|
30 | <!-- add the default CMD namespace to all elements --> |
---|
31 | <xsl:template match="*"> |
---|
32 | <xsl:element namespace="http://www.clarin.eu/cmd/" name="{name()}"> |
---|
33 | <xsl:apply-templates select="@*|node()"/> |
---|
34 | </xsl:element> |
---|
35 | </xsl:template> |
---|
36 | |
---|
37 | </xsl:stylesheet> |
---|
Note: See
TracBrowser
for help on using the repository browser.