TRANSFORM_dpr-to-dpr2-v1.0.xsl
3.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:dpr="http://www.witsml.org/schemas/131/addendum/combo"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.epim.no/schemas/mprml/1">
<xsl:strip-space elements="*"/>
<xsl:output indent="yes"/>
<xsl:variable name="fieldname" select="/dpr:WITSMLComposite/dpr:documentInfo/dpr:DocumentAlias[@namingSystem='ERHFIELDNAME']" />
<xsl:variable name="fieldid" select="/dpr:WITSMLComposite/dpr:documentInfo/dpr:DocumentAlias[@namingSystem='ERHFIELDID']" />
<!-- WITSMLComposite -> objects -->
<xsl:template match="dpr:WITSMLComposite">
<objects xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.epim.no/schemas/mprml/1" version="1.0(MPRML)">
<xsl:apply-templates select="*|node()"/>
</objects>
</xsl:template>
<!-- documentInfo -> documentInfo and add context element -->
<xsl:template match="dpr:documentInfo">
<xsl:element name="documentInfo">
<xsl:apply-templates select="@*|node()"/>
</xsl:element>
<xsl:element name="context">
<xsl:attribute name="xsi:type">obj_report</xsl:attribute>
<title>Vega DPRM</title>
<date>2012-10-14</date>
<reportStatus>final</reportStatus>
<xsl:element name="installation">
<xsl:attribute name="kind">field</xsl:attribute>
<xsl:attribute name="namingSystem">NPD</xsl:attribute>
<xsl:attribute name="uidRef">
<xsl:value-of select="$fieldid" />
</xsl:attribute>
<xsl:value-of select="$fieldname" />
</xsl:element>
</xsl:element>
</xsl:template>
<!-- IGNORE productionOperationSet for now -->
<xsl:template match="dpr:productionOperationSet">
</xsl:template>
<!-- productVolumeSet -> only children -->
<xsl:template match="dpr:productVolumeSet">
<xsl:apply-templates select="@*|node()"/>
</xsl:template>
<!-- productVolumeSet @uid -> remove uid -->
<xsl:template match="dpr:productVolumeSet/@uid">
<xsl:apply-templates select="@*|node()"/>
</xsl:template>
<!-- productVolume -> object xsd:type=obj_productVolume -->
<xsl:template match="dpr:productVolume">
<xsl:element name="object">
<xsl:attribute name="xsi:type">obj_productVolume</xsl:attribute>
<xsl:apply-templates select="@*|node()"/>
</xsl:element>
</xsl:template>
<xsl:template match="dpr:installation">
<xsl:element name="installation">
<xsl:attribute name="kind">field</xsl:attribute>
<xsl:attribute name="namingSystem">NPD</xsl:attribute>
<xsl:apply-templates select="@*|node()"/>
</xsl:element>
</xsl:template>
<!-- For any elements not covered above, copy them over but with the new namespace -->
<xsl:template match="dpr:*">
<xsl:element name="{local-name()}">
<xsl:apply-templates select="@*|node()"/>
</xsl:element>
</xsl:template>
<!-- Convert anything else as-is -->
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>