root / projects / DailyProductionReport_1.0 / XML / Version1.0 / WITSML131 / stylesheets / realtime.xsl @ 16

Revision 16, 13.6 kB (checked in by ryland, 15 years ago)
Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<xsl:stylesheet version="1.0" 
3        xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
4        xmlns:witsml="http://www.witsml.org/schemas/131">
5
6        <xsl:include href="all_object_utility_templates.xsl"/>
7
8<xsl:template match="/">
9        <html>
10        <head>
11                <title>
12                        WITSML Realtime Stylesheet
13                </title>
14        </head>
15
16        <body>
17        <table  border="1" align="center">
18                <tr><th colspan="16" ><font size="+2" color="blue">WITSML</font></th></tr>
19                <tr><th colspan="16"><font size="+2" color="blue">Well Realtime Information</font></th></tr>
20
21                <!--     First do all of the headers     -->
22                <tr><th colspan="16"><font size="+2" color="blue">Realtime Headers</font></th></tr>
23                <xsl:for-each select="/witsml:realtimes/witsml:realtime">
24                        <xsl:apply-templates select="witsml:realtimeHeader"/>
25                </xsl:for-each>
26
27                <!--     Now do everything without the headers.     -->
28                <tr><th colspan="16"><font size="+2" color="blue">Individual Realtimes</font></th></tr>
29                <xsl:for-each select="/witsml:realtimes/witsml:realtime">
30                        <tr>    <td colspan="4"><font size="+1" color="blue">Well Uid: <xsl:value-of select="@uidWell"/></font></td>
31                                <td colspan="4"><font size="+1" color="blue">Wellbore Uid: <xsl:value-of select="@uidWellbore"/></font></td>
32                                <td colspan="4"><font size="+1" color="blue">Subscription: <xsl:value-of select="@idSub"/></font></td>
33                                <td colspan="4"><font size="+1" color="blue">Sequence: <xsl:value-of select="witsml:sequence"/></font></td>
34                        </tr>
35                        <tr>    <td colspan="1"/>
36                                <td colspan="5"><font size="-1"><b>Time Stamp: </b> <xsl:value-of select="witsml:dTim"/></font></td>
37                                <td colspan="5"><font size="-1"><b>Measured Depth: </b>  <xsl:apply-templates select="witsml:md" mode="valueWithUomRef"/></font></td>
38                                <td colspan="5"><font size="-1"><b>Activity Code: </b> <xsl:value-of select="witsml:activityCode"/></font></td>
39                        </tr>
40                        <xsl:apply-templates select="witsml:channel"/>
41                        <xsl:apply-templates select="witsml:record"/>
42
43                </xsl:for-each>
44        </table>
45        </body>
46        </html>
47        </xsl:template>
48
49
50        <!--                            Header Template -->
51        <xsl:template match="witsml:realtimeHeader">
52                        <tr>    <td colspan="2"><font size="+1" color="blue">Header: </font></td>
53                                <td colspan="7"><font size="+1" color="blue">Well Name: </font>  <xsl:value-of select="witsml:nameWell"/></td>
54                                <td colspan="7"><font size="+1" color="blue">Wellbore Name: </font>  <xsl:value-of select="witsml:nameWellbore"/></td>
55                        </tr>
56                        <tr>    <td colspan="2"/>
57                                <td colspan="3"><font size="+1" color="blue">Well Uid: <xsl:value-of select="../@uidWell"/></font></td>
58                                <td colspan="4"><font size="+1" color="blue">Subscription: <xsl:value-of select="../@idSub"/></font></td>
59                                <td colspan="7"><font size="+1" color="blue">Wellbore Uid: <xsl:value-of select="../@uidWellbore"/></font></td>
60                        </tr>
61                        <tr>    <td colspan="2"/>
62                                <td colspan="5"><font size="-1"><b>Service Company: </b> <xsl:value-of select="witsml:serviceCompany"/></font></td>
63                                <td colspan="5"><font size="-1"><b>Creation Date: </b> <xsl:value-of select="witsml:creationDate"/></font></td>
64                                <td colspan="4"><font size="-1"><b>Run Number: </b> <xsl:value-of select="witsml:runNumber"/></font></td>
65                        </tr>
66                        <tr>    <td colspan="2"/>
67                                <td colspan="14"><font size="-1"><b>Desc: </b> <xsl:value-of select="witsml:description"/></font></td>
68                        </tr>
69                        <xsl:for-each select="witsml:interval">
70                                <tr>    <td colspan="2"/>
71                                        <xsl:apply-templates select="."/>
72                                </tr>
73                        </xsl:for-each>
74                        <xsl:for-each select="witsml:groupDefinition">
75                                <xsl:apply-templates select="."/>
76                        </xsl:for-each>
77        </xsl:template>
78
79        <xsl:template match="witsml:groupDefinition">
80                        <tr>    <td colspan="1"/>
81                                <td colspan="2"><font size="-1"><b>Group ID: </b>   <xsl:value-of select="witsml:id"/></font></td>
82                                <td colspan="2"><font size="-1"><b>Multiplexed: </b>  <xsl:value-of select="witsml:multiplexed"/></font></td>
83                                <td colspan="3"><font size="-1"><b>Persisted As log: </b>  <xsl:apply-templates select="witsml:persistedAsLog" mode="refNameString"/></font></td>
84                                <td colspan="3"><font size="-1"><b>Persisted As wellLog: </b>  <xsl:apply-templates select="witsml:persistedAsLog" mode="persistedAsWellLog"/></font></td>
85                                <td colspan="5"><font size="-1"><b>comment: </b>  <xsl:value-of select="witsml:comment"/></font></td>
86                        </tr>
87                        <xsl:for-each select="witsml:interval">
88                                <tr>    <td colspan="2"/>
89                                        <xsl:apply-templates select="."/>
90                                </tr>
91                        </xsl:for-each>
92                        <xsl:for-each select="witsml:channelDefinition">
93                                <xsl:apply-templates select="."/>
94                        </xsl:for-each>
95        </xsl:template>
96
97        <xsl:template match="*" mode="refNameString">
98                <xsl:value-of select="."/>
99                <xsl:text>(uidRef=</xsl:text><xsl:value-of select="@uidRef"/><xsl:text>)</xsl:text>
100        </xsl:template>
101
102        <xsl:template match="witsml:channelDefinition">
103                        <tr>    <td colspan="2"/>
104                                <td colspan="2"><font size="-1"><b>Channel Def: </b></font></td>
105                                <td colspan="2"><font size="-1"><b>Mnemonic: </b>  <xsl:value-of select="witsml:mnemonic"/></font></td>
106                                <td colspan="2"><font size="-1"><b>Data Type: </b>  <xsl:value-of select="witsml:dataType"/></font></td>
107                                <td colspan="4"><font size="-1"><b>Witsml Class: </b>  <xsl:apply-templates select="witsml:classWitsml" mode="RealTimeData"/></font></td>
108                                <td colspan="4"><font size="-1"><b>Alias: </b>  <xsl:value-of select="witsml:mnemAlias"/></font></td>
109                        </tr>
110                        <tr>    <td colspan="4"/>
111                                <td colspan="4"><font size="-1"><b>Column Index: </b>  <xsl:value-of select="witsml:columnIndex"/></font></td>
112                                <td colspan="4"><font size="-1"><b>Unit: </b>  <xsl:value-of select="witsml:unit"/></font></td>
113                        </tr>
114                        <tr>    <td colspan="4"/>
115                                <td colspan="4"><font size="-1"><b>Sensor Offset: </b>  <xsl:apply-templates select="witsml:sensorOffset" mode="valueWithUomRef"/></font></td>
116                                <td colspan="4"><font size="-1"><b>Data Source: </b>  <xsl:value-of select="witsml:dataSource"/></font></td>
117                        </tr>
118                        <tr>    <td colspan="4"/>
119                                <td colspan="12"><font size="-1"><b>Desc: </b>  <xsl:value-of select="witsml:description"/></font></td>
120                        </tr>
121                        <xsl:call-template name="axisDefinition"/>
122                        <xsl:for-each select="witsml:interval">
123                                <tr>    <td colspan="4"/>
124                                        <xsl:apply-templates select="."/>
125                                </tr>
126                        </xsl:for-each>
127        </xsl:template>
128
129        <xsl:template name="axisDefinition">
130                <xsl:if test="witsml:axisDefinition">
131                        <tr>    <td colspan="4"/>
132                                <td colspan="4">
133                                        <table border='3'>
134                                                <tr><th><font size='-2'>count</font></th>
135                                                <xsl:for-each select="witsml:axisDefinition">
136                                                        <td><font size='-2'>
137                                                                <xsl:value-of select="witsml:count"/>
138                                                        </font></td>
139                                                </xsl:for-each></tr>
140
141                                                <tr><th><font size='-2'>name</font></th>
142                                                <xsl:for-each select="witsml:axisDefinition">
143                                                        <td><font size='-2'>
144                                                                <xsl:value-of select="witsml:name"/>
145                                                        </font></td>
146                                                </xsl:for-each></tr>
147
148                                                <tr><th><font size='-2'>pty type</font></th>
149                                                <xsl:for-each select="witsml:axisDefinition">
150                                                        <td><font size='-2'>
151                                                                <xsl:value-of select="witsml:propertyType"/>
152                                                        </font></td>
153                                                </xsl:for-each></tr>
154
155                                                <tr><th><font size='-2'>uom</font></th>
156                                                <xsl:for-each select="witsml:axisDefinition">
157                                                        <td><font size='-2'>
158                                                                <xsl:value-of select="witsml:uom"/>
159                                                        </font></td>
160                                                </xsl:for-each></tr>
161
162                                                <tr><th><font size='-2'>coords</font></th>
163                                                <xsl:for-each select="witsml:axisDefinition">
164                                                        <td><font size='-2'>
165                                                                <xsl:value-of select="witsml:doubleValues"/>
166                                                        </font></td>
167                                                </xsl:for-each></tr>
168                                        </table>
169                                </td>
170                        </tr>
171                </xsl:if>
172        </xsl:template>
173
174        <xsl:template match="witsml:interval">
175                                <td colspan="2"><font size="-1"><b>Interval: </b></font></td>
176                                <td colspan="2"><font size="-1"><b>Type: </b>  <xsl:value-of select="witsml:type"/></font></td>
177                                <td colspan="2"><font size="-1"><b>Method: </b>  <xsl:value-of select="witsml:method"/></font></td>
178                                <td colspan="4"><font size="-1"><b>Distance Interval: </b>  <xsl:apply-templates select="witsml:distanceInterval" mode="valueWithUomRef"/></font></td>
179                                <td colspan="4"><font size="-1"><b>Time Interval: </b>  <xsl:apply-templates select="witsml:timeInterval" mode="valueWithUomRef"/></font></td>
180        </xsl:template>
181       
182
183        <xsl:template match="witsml:channel">                           
184                        <tr>    <td colspan="1"></td>
185                                <td colspan="2"><font size="-1"><b>Channel: </b></font></td>
186                                <td colspan="3"><font size="-1"><b>Group ID: </b></font>  <xsl:value-of select="witsml:id"/></td>
187                                <td colspan="3"><font size="-1"><b>Mnemonic: </b></font>  <xsl:value-of select="witsml:mnemonic"/></td>
188                                <td colspan="5"><font size="-1"><b>Data Density: </b>  <xsl:apply-templates select="witsml:densData" mode="valueWithUomRef"/></font></td>
189                        </tr>                   
190                        <tr>    <td colspan="3"></td>
191                                <td colspan="6"><font size="-1"><b>Time Stamp: </b></font>  <xsl:value-of select="witsml:dTim"/></td>
192                                <td colspan="5"><font size="-1"><b>Measured Depth: </b>  <xsl:apply-templates select="witsml:md" mode="valueWithUomRef"/></font></td>
193                        </tr>
194                        <tr>    <td colspan="3"></td>
195                                <td colspan="3"><font size="-1"><b>Value: </b>  <xsl:apply-templates select="witsml:value" mode="valueWithUomRef"/></font></td>
196                                <td colspan="6"><font size="-1"><b>Data Qaulity: </b></font>  <xsl:value-of select="witsml:qualData"/></td>
197                                <td colspan="5"><font size="-1"><b>fet: </b>  <xsl:apply-templates select="witsml:fet" mode="valueWithUomRef"/></font></td>
198                        </tr>
199        </xsl:template> 
200       
201
202        <xsl:template match="witsml:record">
203                <tr>    <td colspan="1"></td>
204                        <td colspan="2"><font size="-1"><b>Record: </b></font></td>
205                        <td colspan="2"><font size="-1"><b>Group ID: </b></font>  <xsl:value-of select="witsml:id"/></td>
206                        <td colspan="2"><font size="-1"><b>Sequence #: </b></font>  <xsl:value-of select="witsml:seq"/></td>
207                        <td colspan="5"><font size="-1"><b>Time Stamp: </b></font>  <xsl:value-of select="witsml:dTim"/></td>
208                        <td colspan="4"><font size="-1"><b>Measured Depth: </b>  <xsl:apply-templates select="witsml:md" mode="valueWithUomRef"/></font></td>
209                </tr>
210                <tr>    <td colspan="3"></td>
211                        <xsl:call-template name="record-mne">
212                                <xsl:with-param name="group"><xsl:value-of select="witsml:id"/></xsl:with-param>
213                                <xsl:with-param name="value"><xsl:value-of select="witsml:value"/></xsl:with-param>
214                        </xsl:call-template>
215                </tr>
216                <tr>    <td colspan="3"></td>
217                        <xsl:call-template name="record-value">
218                                <xsl:with-param name="group"><xsl:value-of select="witsml:id"/></xsl:with-param>
219                                <xsl:with-param name="value"><xsl:value-of select="witsml:value"/></xsl:with-param>
220                        </xsl:call-template>
221                </tr>
222        </xsl:template> 
223
224
225        <!-- Recursive template to do a heading for each value in a record string. -->
226        <xsl:template name="record-mne">
227                <xsl:param name="group"/>       <!-- The group id. -->
228                <xsl:param name="value"/>       <!-- Comma delimited string of values. -->
229                <xsl:param name="column">1</xsl:param>
230                <xsl:choose>
231                        <xsl:when test="$value=''">
232                                <!-- We are finished. -->
233                        </xsl:when>
234                        <xsl:when test="contains($value,',')">
235                                <!-- More than one value remaining. -->
236                                <td>
237                                        <xsl:value-of select="/witsml:realtimes/witsml:realtime/witsml:realtimeHeader/witsml:groupDefinition[witsml:id=$group]/witsml:channelDefinition[witsml:columnIndex=$column]/witsml:mnemonic"/>
238                                </td>
239                                <xsl:call-template name="record-mne">
240                                        <xsl:with-param name="group"><xsl:value-of select="$group"/></xsl:with-param>
241                                        <xsl:with-param name="value"><xsl:value-of select="substring-after($value,',')"/></xsl:with-param>
242                                        <xsl:with-param name="column"><xsl:value-of select="$column +1"/></xsl:with-param>
243                                </xsl:call-template>           
244                        </xsl:when>
245                        <xsl:otherwise>
246                                <!-- One more value. -->
247                                <td>
248                                        <xsl:value-of select="/witsml:realtimes/witsml:realtime/witsml:realtimeHeader/witsml:groupDefinition[witsml:id=$group]/witsml:channelDefinition[witsml:columnIndex=$column]/witsml:mnemonic"/>
249                                </td>
250                        </xsl:otherwise>
251                </xsl:choose>
252        </xsl:template>
253        <!-- Recursive template to do each value in a record string. -->
254        <xsl:template name="record-value">
255                <xsl:param name="group"/>       <!-- The group id. -->
256                <xsl:param name="value"/>
257                <xsl:param name="column">1</xsl:param>
258                <xsl:choose>
259                        <xsl:when test="$value=''">
260                                <!-- We are finished. -->
261                        </xsl:when>
262                        <xsl:when test="contains($value,',')">
263                                <!-- More than one value remaining. -->
264                                <td>
265                                        <xsl:value-of select="substring-before($value,',')"/>
266                                        <xsl:text> </xsl:text>
267                                        <xsl:apply-templates select="/witsml:realtimes/witsml:realtime/witsml:realtimeHeader/witsml:groupDefinition[witsml:id=$group]/witsml:channelDefinition[witsml:columnIndex=$column]/witsml:unit" 
268                                                mode="UnitRef"/>
269                                </td>
270                                <xsl:call-template name="record-value">
271                                        <xsl:with-param name="group"><xsl:value-of select="$group"/></xsl:with-param>
272                                        <xsl:with-param name="value"><xsl:value-of select="substring-after($value,',')"/></xsl:with-param>
273                                        <xsl:with-param name="column"><xsl:value-of select="$column +1"/></xsl:with-param>
274                                </xsl:call-template>           
275                        </xsl:when>
276                        <xsl:otherwise>
277                                <!-- One more value. -->
278                                <td>
279                                        <xsl:value-of select="$value"/>
280                                        <xsl:text> </xsl:text>
281                                        <xsl:apply-templates select="/witsml:realtimes/witsml:realtime/witsml:realtimeHeader/witsml:groupDefinition[witsml:id=$group]/witsml:channelDefinition[witsml:columnIndex=$column]/witsml:unit" 
282                                                mode="UnitRef"/>
283                                </td>
284                        </xsl:otherwise>
285                </xsl:choose>
286        </xsl:template>
287
288
289        <!-- RealTimeData linked to the enumValues file. -->
290        <xsl:template match="*" mode="RealTimeData">
291                <a href="../ancillary/enumValues.xml#RealTimeData::{.}">
292                        <xsl:value-of select="."/>
293                </a>
294        </xsl:template>
295
296
297
298</xsl:stylesheet>
Note: See TracBrowser for help on using the browser.