dd2WStree.xsl
6.45 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">
<xsl:output method="xml"/>
<xsl:template match="dataRoot/dataCenter">
<dataRoot>
<dataCenter name="AMDA" desc="AMDA_Internal_Data_Base" xml:id="myLocalData-treeRootNode">
<xsl:for-each select="mission">
<xsl:choose>
<xsl:when test="not(observatory)">
<xsl:if test="@available = '1'">
<mission att="{@attention}" name="{@name}" rank="{@rank}" xml:id="{@name}" desc="{@desc}" target="{@target}" available="{@available}">
<xsl:choose>
<xsl:when test="group">
<xsl:for-each select="group">
<xsl:if test="@restricted = ''">
<xsl:for-each select="instrument">
<instrument att="{@attention}" name="{@name}" xml:id="{@xml:id}" desc="{@desc}" restricted="{@restricted}">
<xsl:for-each select="dataset">
<xsl:apply-templates select="."/>
</xsl:for-each>
</instrument>
</xsl:for-each>
</xsl:if>
</xsl:for-each>
</xsl:when>
<xsl:when test="simulationModel">
<xsl:for-each select="simulationModel">
<simulationModel att="{@attention}" name="{@name}" xml:id="{@xml:id}" desc="{@desc}" restricted="{@restricted}">
<xsl:for-each select="instrument">
<instrument att="{@attention}" name="{@name}" xml:id="{@xml:id}" desc="{@desc}" restricted="{@restricted}">
<xsl:for-each select="dataset">
<xsl:apply-templates select="."/>
</xsl:for-each>
</instrument>
</xsl:for-each>
</simulationModel>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<xsl:for-each select="instrument">
<instrument att="{@attention}" name="{@name}" xml:id="{parent::mission/@name}:{@name}" desc="{@desc}" restricted="{@restricted}">
<xsl:for-each select="datasetGroup">
<xsl:if test="@restricted = ''">
<xsl:for-each select="dataset">
<xsl:apply-templates select="."/>
</xsl:for-each>
</xsl:if>
</xsl:for-each>
<xsl:for-each select="dataset">
<xsl:apply-templates select="."/>
</xsl:for-each>
</instrument>
</xsl:for-each>
</xsl:otherwise>
</xsl:choose>
</mission>
</xsl:if>
</xsl:when>
<xsl:otherwise>
<xsl:for-each select="observatory">
<xsl:if test="parent::mission/@available = '1'">
<mission att="{parent::mission/@attention}" name="{@name}" rank="{parent::mission/@rank}" xml:id="{@xml:id}" desc="{parent::mission/@desc}" target="{parent::mission/@target}" available="{parent::mission/@available}">
<xsl:for-each select="instrument">
<instrument att="{@attention}" name="{@name}" xml:id="{@xml:id}" desc="{@desc}">
<xsl:for-each select="dataset">
<xsl:apply-templates select="."/>
</xsl:for-each>
</instrument>
</xsl:for-each>
</mission>
</xsl:if>
</xsl:for-each>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</dataCenter>
</dataRoot>
</xsl:template>
<xsl:template match="dataset">
<dataset att="{@attention}" restricted="{@restricted}" name="{@name}" xml:id="{@xml:id}"
sampling="{@sampling}" maxSampling="{@maxSampling}" dataStart="{@dataStart}"
dataStop="{@dataStop}" dataSource="{@dataSource}" target="{@target}">
<xsl:for-each select="parameter">
<xsl:choose>
<xsl:when test="count(./child::*) > 0 ">
<parameter name="{@name}" units="{@units}" display_type="{@display_type}"
xml:id="{@xml:id}">
<xsl:for-each select="component">
<component name="{@name}" xml:id="{@xml:id}"/>
</xsl:for-each>
</parameter>
</xsl:when>
<xsl:otherwise>
<parameter name="{@name}" display_type="{@display_type}" units="{@units}"
xml:id="{@xml:id}"/>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</dataset>
</xsl:template>
</xsl:stylesheet>