-
Notifications
You must be signed in to change notification settings - Fork 0
/
reqif_info.xsl
153 lines (138 loc) · 6.32 KB
/
reqif_info.xsl
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
<xsl:stylesheet
version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:reqif="http://www.omg.org/spec/ReqIF/20110401/reqif.xsd"
xmlns:rm="http://www.ibm.com/rm"
xmlns:rm-reqif="http://www.ibm.com/rm/reqif">
<xsl:output omit-xml-declaration="yes" method="html"/>
<xsl:template match="node()|@*" name="identity">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<xsl:key name="sameAsUriFromID"
match="rm-reqif:DATATYPE-DEFINITION-EXTENSION/rm-reqif:SAME-AS/text()
|rm-reqif:ATTRIBUTE-DEFINITION-EXTENSION/rm-reqif:SAME-AS/text()"
use="../../reqif:ENUM-VALUE-REF/text()
|../../reqif:DATATYPE-DEFINITION-ENUMERATION-REF/text()
|../../reqif:DATATYPE-DEFINITION-INTEGER-REF/text()
|../../reqif:ATTRIBUTE-DEFINITION-XHTML-REF/text()
"/>
<xsl:key name="attrDefEnumFromDataTypeID"
match="reqif:SPEC-ATTRIBUTES/*"
use="@IDENTIFIER"/>
<xsl:key name="attrdefFromName"
match="reqif:SPEC-ATTRIBUTES/*"
use="@LONG-NAME"/>
<xsl:template match="reqif:REQ-IF">
<html>
<head>
</head>
<body>
<title><xsl:value-of select="base-uri()" /></title>
<h1>Source: <xsl:value-of select="base-uri()" /></h1>
<h1>Summary</h1>
<xsl:variable name="specobjects" select="//reqif:SPEC-OBJECT"/>
SPEC-OBJECTS: <xsl:value-of select="count($specobjects)"/><br/>
<xsl:variable name="spec-types" select="//reqif:SPEC-TYPES/reqif:SPEC-OBJECT-TYPE"/>
<table style="border:1px solid black;">
<tr><td><h1>SPEC-OBJECT-TYPE (<xsl:value-of select="count($spec-types)"/>)</h1></td></tr>
<tr>
<td><b>LONG-NAME</b></td><td><b>ID</b></td>
</tr>
<xsl:for-each select="$spec-types">
<xsl:variable name="long-name" select="@LONG-NAME"/>
<xsl:variable name="id" select="@IDENTIFIER"/>
<tr>
<td><xsl:value-of select="$long-name"/></td>
<td><xsl:value-of select="$id"/></td>
</tr>
</xsl:for-each>
</table>
<h1>Attribute Definitions with sameAs</h1>
<table style="border:1px solid black;">
<tr>
<td><b>sameas</b></td><td><b>LONG-NAME</b></td><td><b>id</b></td>
</tr>
<xsl:for-each select="//rm-reqif:ATTRIBUTE-DEFINITION-EXTENSION/rm-reqif:SAME-AS">
<xsl:sort select="text()"/>
<xsl:variable name="dataTypeSameAs" select="text()"/>
<xsl:variable name="dataTypeID" select="../*[1]/text()"/>
<xsl:variable name="attrdef" select="key('attrDefEnumFromDataTypeID', $dataTypeID)"/>
<xsl:variable name="dataTypeName" select="$attrdef/@LONG-NAME"/>
<tr>
<td><xsl:value-of select="$dataTypeSameAs"/></td>
<td><xsl:value-of select="$dataTypeName"/></td>
<td><xsl:value-of select="$dataTypeID"/></td>
</tr>
</xsl:for-each>
</table>
<h1>Attribute Types with sameAs</h1>
<table style="border:1px solid black;">
<tr>
<td><b>sameas</b></td><td><b>LONG-NAME</b></td><td><b>id</b></td>
</tr>
<xsl:for-each select="//rm:SPEC-OBJECT-TYPE-EXTENSION/rm:SAME-AS">
<xsl:variable name="dataTypeSameAs" select="text()"/>
<xsl:variable name="dataTypeID" select="../*[1]/text()"/>
<xsl:variable name="attrdef" select="key('attrDefEnumFromDataTypeID', $dataTypeID)"/>
<xsl:variable name="dataTypeName" select="$attrdef/@LONG-NAME"/>
<tr>
<td><xsl:value-of select="$dataTypeSameAs"/></td>
<td><xsl:value-of select="$dataTypeName"/></td>
<td><xsl:value-of select="$dataTypeID"/></td>
</tr>
</xsl:for-each>
</table>
<h1>Attribute Types with sameAs</h1>
<table style="border:1px solid black;">
<tr>
<td><b>sameas</b></td><td><b>LONG-NAME</b></td><td><b>id</b></td>
</tr>
<xsl:for-each select="//rm:SPEC-OBJECT-TYPE-EXTENSION/rm:SAME-AS">
<xsl:variable name="dataTypeSameAs" select="text()"/>
<xsl:variable name="dataTypeID" select="../*[1]/text()"/>
<xsl:variable name="attrdef" select="key('attrDefEnumFromDataTypeID', $dataTypeID)"/>
<xsl:variable name="dataTypeName" select="$attrdef/@LONG-NAME"/>
<tr>
<td><xsl:value-of select="$dataTypeSameAs"/></td>
<td><xsl:value-of select="$dataTypeName"/></td>
<td><xsl:value-of select="$dataTypeID"/></td>
</tr>
</xsl:for-each>
</table>
<h1>Attribute Datatypes</h1>
<table style="border:1px solid black;">
<tr>
<td><b>LONG-NAME</b></td><td><b>Values</b></td><td><b>ID</b></td><td><b>sameas</b></td>
</tr>
<xsl:for-each select="//reqif:DATATYPE-DEFINITION-ENUMERATION">
<xsl:sort select="@LONG-NAME"/>
<xsl:variable name="sameAsURI" select="key('sameAsUriFromID', @IDENTIFIER)"/>
<tr>
<td><xsl:value-of select="@LONG-NAME"/></td>
<td>
<table style="border:1px solid black;">
<tr>
<td><b>Name</b></td> <td><b>Value</b></td> <td><b>ID</b></td>
</tr>
<xsl:for-each select="reqif:SPECIFIED-VALUES/reqif:ENUM-VALUE">
<xsl:sort select="reqif:PROPERTIES/reqif:EMBEDDED-VALUE/@KEY"/>
<xsl:variable name="long_name" select="@LONG-NAME"/>
<tr>
<td><xsl:value-of select="$long_name"/></td>
<td><xsl:value-of select="reqif:PROPERTIES/reqif:EMBEDDED-VALUE/@KEY"/></td>
<td><xsl:value-of select="@IDENTIFIER"/></td>
</tr>
</xsl:for-each>
</table>
</td>
<td><xsl:value-of select="@IDENTIFIER"/></td>
<td><xsl:value-of select="$sameAsURI"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>