1 | <?xml version="1.0" encoding="UTF-8"?> |
---|
2 | <xsl:stylesheet version="2.0" |
---|
3 | xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:dcworms="DCWormsResSchema.xsd" |
---|
4 | xmlns:debb2dcworms="../../debb2dcworms.xsd"> |
---|
5 | |
---|
6 | <!-- Specification of the output document --> |
---|
7 | <xsl:output method="xml" version="1.0" encoding="UTF-8" |
---|
8 | indent="yes" /> |
---|
9 | |
---|
10 | <!-- Root of the DCWoRMS XML document --> |
---|
11 | <xsl:variable name="rootDoc" select="/" /> |
---|
12 | |
---|
13 | <!-- Information about schedulers and estimators --> |
---|
14 | <xsl:param name="additionalInformationFileName" select="additionalInformationFileName" /> |
---|
15 | |
---|
16 | |
---|
17 | <xsl:variable name="nestedDoc" |
---|
18 | select="document($additionalInformationFileName)" /> |
---|
19 | |
---|
20 | <xsl:template match="/"> |
---|
21 | <xsl:comment> |
---|
22 | This is DEBB information (taken from PLM XML and DEBBComponent |
---|
23 | files), updated by schedulers and estimators. Moreover, all elements |
---|
24 | are sorted and appear in correct order, according to the schema. |
---|
25 | </xsl:comment> |
---|
26 | <xsl:comment> |
---|
27 | Schedulers and estimators information is loaded from |
---|
28 | <xsl:value-of select="$additionalInformationFileName" /> |
---|
29 | file |
---|
30 | </xsl:comment> |
---|
31 | |
---|
32 | <xsl:apply-templates select="environment" /> |
---|
33 | |
---|
34 | </xsl:template> |
---|
35 | |
---|
36 | <xsl:template match="environment"> |
---|
37 | <xsl:copy> |
---|
38 | <xsl:copy-of select="@*" /> |
---|
39 | <xsl:apply-templates select="resources" /> |
---|
40 | </xsl:copy> |
---|
41 | </xsl:template> |
---|
42 | |
---|
43 | <xsl:template match="resources"> |
---|
44 | <xsl:copy copy-namespaces="no"> |
---|
45 | <xsl:apply-templates select="//resources/computingResource" /> |
---|
46 | <xsl:element name="scheduler"> |
---|
47 | <xsl:attribute name="class">Cluster</xsl:attribute> |
---|
48 | <xsl:attribute name="name">cluster</xsl:attribute> |
---|
49 | <xsl:apply-templates select="$nestedDoc//schedulingPlugin" /> |
---|
50 | </xsl:element> |
---|
51 | </xsl:copy> |
---|
52 | </xsl:template> |
---|
53 | |
---|
54 | <xsl:template match="schedulingPlugin"> |
---|
55 | <xsl:element name="schedulingPlugin"> |
---|
56 | <xsl:element name="name"> |
---|
57 | <xsl:value-of select="name" /> |
---|
58 | </xsl:element> |
---|
59 | <xsl:if test="frequency != ''"> |
---|
60 | <xsl:element name="frequency"> |
---|
61 | <xsl:value-of> |
---|
62 | frequency |
---|
63 | </xsl:value-of> |
---|
64 | </xsl:element> |
---|
65 | </xsl:if> |
---|
66 | </xsl:element> |
---|
67 | <xsl:element name="managedComputingResources"> |
---|
68 | <!-- TODO: This parameter should be taken from somewhere. --> |
---|
69 | <xsl:attribute name="include">false</xsl:attribute> |
---|
70 | <xsl:element name="resourceName"> |
---|
71 | RESOURCENAME |
---|
72 | </xsl:element> |
---|
73 | </xsl:element> |
---|
74 | </xsl:template> |
---|
75 | |
---|
76 | <xsl:template match="computingResource"> |
---|
77 | <xsl:copy copy-namespaces="no"> |
---|
78 | <xsl:copy-of select="@*" /> |
---|
79 | <!-- Find nested elements in appropriate order and copy them --> |
---|
80 | <!-- resourceUnit --> |
---|
81 | <xsl:apply-templates select="resourceUnit" /> |
---|
82 | <!-- parameter --> |
---|
83 | <xsl:apply-templates select="parameter" /> |
---|
84 | <!-- profile --> |
---|
85 | <xsl:apply-templates select="profile" /> |
---|
86 | <!-- location --> |
---|
87 | <xsl:apply-templates select="location" /> |
---|
88 | <!-- computingResource --> |
---|
89 | <xsl:apply-templates select="computingResource" /> |
---|
90 | </xsl:copy> |
---|
91 | </xsl:template> |
---|
92 | |
---|
93 | <xsl:template match="resourceUnit | parameter | profile | location"> |
---|
94 | <xsl:copy-of select="." copy-namespaces="no" /> |
---|
95 | </xsl:template> |
---|
96 | |
---|
97 | <!-- <xsl:template match="@*|node()"> <xsl:copy> <xsl:apply-templates select="@*"/> |
---|
98 | <xsl:apply-templates/> </xsl:copy> </xsl:template> --> |
---|
99 | |
---|
100 | </xsl:stylesheet> |
---|