1 |
<?xml version="1.0" encoding="UTF-8"?> <!-- Prologo XML --> |
2 |
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <!-- Dichiarazione del documento XSLT --> |
3 |
<!-- <xsl:stylesheet version="1.0" |
4 |
xmlns:xsl="http://www.w3.org/TR/WD-xsl"> --> |
5 |
|
6 |
<!-- |
7 |
===================================================================================== |
8 |
Stylesheet: McmdTemplate.xsl |
9 |
Version: 1.0 (2005-03-01) |
10 |
Author: Maurizio Nagni |
11 |
Descr.: Merge the output of the McmdToXML.c script with the McmdInfo.xml |
12 |
file to generate a human readble verion of the Mcmd packet. |
13 |
The McmdReference Template build the header for the table that will |
14 |
contain the several types of MCMDs. |
15 |
===================================================================================== |
16 |
--> |
17 |
|
18 |
<!--Contains some utility to converts dec/hex/bin numbers--> |
19 |
<xsl:include href="numberutils_lib.xsl"/> |
20 |
|
21 |
<!--Contains all the customer specific parameters--> |
22 |
<!--<xsl:include href="Configure.xsl"/>--> |
23 |
|
24 |
<!-- Define which a key called "varDes" |
25 |
which will search inside the node "param" of the reference |
26 |
McmdInfo.xml (or whatever file instead of the is used) |
27 |
all values values of the node "@id" matching the valued passed when |
28 |
the key "param" is called --> |
29 |
<!-- No xml file is defined here because the xsl:key is absolutely generic --> |
30 |
<xsl:key name="varDes" match="mcmd" use="@id"/> |
31 |
|
32 |
<xsl:template match="/" name="McmdReference"> |
33 |
<xsl:param name="code"/> |
34 |
<xsl:for-each select="document('McmdInfo.xml')"> |
35 |
<xsl:for-each select="key('varDes', $code)"> |
36 |
<tr bgcolor="#FF0000"><td align="center" colspan='99'><th><xsl:value-of select="@name"/></th></td></tr> |
37 |
<tr> |
38 |
<xsl:for-each select="param"> |
39 |
<td bgcolor="#FF7700" align="left"><th><xsl:value-of select="@name"/></th></td> |
40 |
</xsl:for-each> |
41 |
</tr> |
42 |
</xsl:for-each> |
43 |
</xsl:for-each> |
44 |
</xsl:template> |
45 |
|
46 |
<xsl:template match="/" name="McmdTemplate"> |
47 |
<html> |
48 |
<body STYLE="font-family:Arial, helvetica, sans-serif; font-size:10pt"> |
49 |
<h2>Mcmd Event</h2> |
50 |
<table border='1'> |
51 |
<xsl:for-each select="//McmdEvent"> |
52 |
<tr bgcolor="#1acd32"> |
53 |
<th align="center" width='10%'>Packet OBT</th> |
54 |
<th align="center" width='10%'>Packet Num</th> |
55 |
</tr> |
56 |
<tr> |
57 |
<th align="left"><xsl:value-of select="@PacketOBT"/></th> |
58 |
<th align="left"><xsl:value-of select="@PacketNum"/></th> |
59 |
</tr> |
60 |
<xsl:for-each select="McmdRecord"> |
61 |
<tr bgcolor="#7777FF"> |
62 |
<th align="center">Mcmd OBT</th> |
63 |
<th align="center">SeqId</th> |
64 |
<th align="center">Type</th> |
65 |
<td rowspan = '2' width='100%'> |
66 |
<table bgcolor="#FFFFFF" width='100%' heigth='4'> |
67 |
<!--Here I fill the table header names --> |
68 |
<xsl:variable name="retTemplate"> |
69 |
<xsl:call-template name="McmdReference"> |
70 |
<xsl:with-param name="code" select="@ID1"/> |
71 |
</xsl:call-template> |
72 |
</xsl:variable> |
73 |
<xsl:if test='$retTemplate=""'> |
74 |
<tr><td><th align="left"><xsl:value-of select="ID1"/> - n.a.</th></td></tr> |
75 |
</xsl:if> |
76 |
<xsl:if test='$retTemplate!=""'> |
77 |
<xsl:copy-of select="$retTemplate" /> |
78 |
</xsl:if> |
79 |
<!-- Here I fill the table values (take care of order!) --> |
80 |
<tr rowspan='2'> |
81 |
<xsl:for-each select="param"> |
82 |
<td><th align="left"><xsl:value-of select="."/></th></td> |
83 |
</xsl:for-each> |
84 |
</tr> |
85 |
</table> |
86 |
</td> |
87 |
</tr> |
88 |
<tr> |
89 |
<th align="left"> |
90 |
<xsl:value-of select="@McmdOBT"/> |
91 |
</th> |
92 |
<th align="left"><xsl:value-of select="@SeqID"/></th> |
93 |
<th align="left"><xsl:value-of select="@ID1"/></th> |
94 |
</tr> |
95 |
</xsl:for-each> |
96 |
</xsl:for-each> |
97 |
|
98 |
</table> |
99 |
<!-- |
100 |
<td> |
101 |
0x |
102 |
<xsl:call-template name="Dec2Hex"> |
103 |
<xsl:with-param name="value" select="INFO1"/> |
104 |
</xsl:call-template> |
105 |
|
106 |
<xsl:value-of select="INFO1"/> |
107 |
</td> |
108 |
--> |
109 |
|
110 |
</body> |
111 |
</html> |
112 |
</xsl:template> |
113 |
|
114 |
</xsl:stylesheet> |