Refactor for testing interactive selection input
[alexxy/gromacs.git] / src / gromacs / selection / tests / refdata / referencedata.xsl
1 <?xml version="1.0"?>
2
3 <xsl:stylesheet version="1.0"
4     xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
5
6 <xsl:import href="common-referencedata.xsl"/>
7
8 <!-- Index handling reference data -->
9
10 <xsl:template match="BlockAtoms">
11     <xsl:if test="Sequence[@Name='Input']">
12         <h2>Input Atoms</h2>
13         <xsl:call-template name="SequenceAsHorizontalTable">
14             <xsl:with-param name="root" select="Sequence[@Name='Input']"/>
15         </xsl:call-template>
16     </xsl:if>
17     <h2>Blocks</h2>
18     <table border="1">
19         <tr>
20             <th>Atom count</th>
21             <th>Atoms</th>
22         </tr>
23         <xsl:for-each select="Block">
24             <tr>
25                 <td><xsl:value-of select="Sequence[@Name='Atoms']/Int[@Name='Length']"/></td>
26                 <td>
27                     <xsl:call-template name="SequenceAsCSV">
28                         <xsl:with-param name="root" select="Sequence[@Name='Atoms']"/>
29                     </xsl:call-template>
30                 </td>
31             </tr>
32         </xsl:for-each>
33     </table>
34 </xsl:template>
35
36 <xsl:template match="IndexMapping">
37     <h2><xsl:value-of select="@Name"/></h2>
38     <h3>Input Atoms</h3>
39     <xsl:call-template name="SequenceAsHorizontalTable">
40         <xsl:with-param name="root" select="Sequence[@Name='Input']"/>
41     </xsl:call-template>
42     <h3>Mapping</h3>
43     <table border="1">
44         <tr>
45             <th>RefId</th>
46             <xsl:if test="Block/Int[@Name='MapId']">
47                 <th>MapId</th>
48             </xsl:if>
49             <th>Atom count</th>
50             <th>Atoms</th>
51         </tr>
52         <xsl:for-each select="Block">
53             <tr>
54                 <td><xsl:value-of select="Int[@Name='RefId']"/></td>
55                 <xsl:if test="Int[@Name='MapId']">
56                     <td><xsl:value-of select="Int[@Name='MapId']"/></td>
57                 </xsl:if>
58                 <td><xsl:value-of select="Sequence[@Name='Atoms']/Int[@Name='Length']"/></td>
59                 <td>
60                     <xsl:call-template name="SequenceAsCSV">
61                         <xsl:with-param name="root" select="Sequence[@Name='Atoms']"/>
62                     </xsl:call-template>
63                 </td>
64             </tr>
65         </xsl:for-each>
66     </table>
67 </xsl:template>
68
69 <xsl:template match="OrgIdGroups">
70     <h2>Groups: <xsl:value-of select="@Name"/></h2>
71     <table>
72         <tr>
73             <td>Group count:</td>
74             <td><xsl:value-of select="Int[@Name='GroupCount']"/></td>
75         </tr>
76         <tr>
77             <td>OrgId</td>
78             <td>
79                 <xsl:call-template name="SequenceAsCSV">
80                     <xsl:with-param name="root" select="Sequence[@Name='OrgId']"/>
81                 </xsl:call-template>
82             </td>
83         </tr>
84     </table>
85 </xsl:template>
86
87 <!-- Position calculation reference data -->
88
89 <xsl:template match="InitializedPositions">
90     <h2>Initialized Positions</h2>
91     <xsl:apply-templates />
92 </xsl:template>
93
94 <xsl:template match="EvaluatedPositions">
95     <h2>Evaluated for <xsl:value-of select="@Name"/></h2>
96     <xsl:apply-templates />
97 </xsl:template>
98
99 <xsl:template match="Positions">
100     <xsl:if test="@Name">
101         <h3><xsl:value-of select="@Name"/></h3>
102     </xsl:if>
103     <table>
104         <tr>
105             <td>Count:</td>
106             <td>
107                 <xsl:value-of select="Int[@Name='Count']"/>
108                 (type: <xsl:value-of select="String[@Name='Type']"/>)
109             </td>
110         </tr>
111         <tr>
112             <td>Blocks:</td>
113             <td>
114                 <xsl:call-template name="SequenceAsCSV">
115                     <xsl:with-param name="root" select="Sequence[@Name='Block']"/>
116                 </xsl:call-template>
117             </td>
118         </tr>
119     </table>
120     <table border="1">
121         <tr>
122             <th>RefId</th>
123             <th>Atom count</th>
124             <th>Atoms</th>
125             <xsl:if test="Position/Vector[@Name='Coordinates']">
126                 <th>Coordinates</th>
127             </xsl:if>
128             <xsl:if test="Position/Vector[@Name='Velocity']">
129                 <th>Velocity</th>
130             </xsl:if>
131             <xsl:if test="Position/Vector[@Name='Force']">
132                 <th>Force</th>
133             </xsl:if>
134         </tr>
135         <xsl:for-each select="Position">
136             <tr>
137                 <td><xsl:value-of select="Int[@Name='RefId']"/></td>
138                 <td><xsl:value-of select="Sequence[@Name='Atoms']/Int[@Name='Length']"/></td>
139                 <td>
140                     <xsl:call-template name="SequenceAsCSV">
141                         <xsl:with-param name="root" select="Sequence[@Name='Atoms']"/>
142                     </xsl:call-template>
143                 </td>
144                 <xsl:if test="Vector[@Name='Coordinates']">
145                     <td>
146                         <xsl:apply-templates select="Vector[@Name='Coordinates']"/>
147                     </td>
148                 </xsl:if>
149                 <xsl:if test="Vector[@Name='Velocity']">
150                     <td>
151                         <xsl:apply-templates select="Vector[@Name='Velocity']"/>
152                     </td>
153                 </xsl:if>
154                 <xsl:if test="Vector[@Name='Force']">
155                     <td>
156                         <xsl:apply-templates select="Vector[@Name='Force']"/>
157                     </td>
158                 </xsl:if>
159             </tr>
160         </xsl:for-each>
161     </table>
162 </xsl:template>
163
164 <!-- Selection reference data -->
165
166 <xsl:key name="SelectionName" match="ParsedSelections/ParsedSelection" use="@Name"/>
167
168 <xsl:template match="ParsedSelections">
169     <h2>Parsed Selections</h2>
170     <table border="1">
171         <tr>
172             <th/>
173             <th>Input</th>
174             <xsl:if test="*/String[@Name='Name']">
175                 <th>Name</th>
176             </xsl:if>
177             <th>Text</th>
178             <th>Dynamic</th>
179         </tr>
180         <xsl:for-each select="*">
181         <tr>
182             <td><xsl:value-of select="@Name"/></td>
183             <td><xsl:value-of select="String[@Name='Input']"/></td>
184             <xsl:if test="String[@Name='Name']">
185                 <td><xsl:value-of select="String[@Name='Name']"/></td>
186             </xsl:if>
187             <td><xsl:value-of select="String[@Name='Text']"/></td>
188             <td><xsl:value-of select="Bool[@Name='Dynamic']"/></td>
189         </tr>
190         </xsl:for-each>
191     </table>
192 </xsl:template>
193
194 <xsl:template match="CompiledSelections">
195     <h2>Compiled Selections</h2>
196     <xsl:apply-templates />
197 </xsl:template>
198
199 <xsl:template match="EvaluatedSelections">
200     <h2>Evaluated for <xsl:value-of select="@Name"/></h2>
201     <xsl:apply-templates />
202 </xsl:template>
203
204 <xsl:template match="Selection">
205     <h3><xsl:value-of select="@Name"/></h3>
206     <table>
207         <xsl:if test="String[@Name='Name']">
208             <tr>
209                 <td>Name:</td>
210                 <td><xsl:value-of select="String[@Name='Name']"/></td>
211             </tr>
212         </xsl:if>
213         <tr>
214             <td>Selection text:</td>
215             <td>
216                 <xsl:value-of select="key('SelectionName', @Name)/String[@Name='Text']"/>
217             </td>
218         </tr>
219         <xsl:if test="Sequence[@Name='Atoms']">
220             <tr>
221                 <td>Atoms (<xsl:value-of select="Sequence[@Name='Atoms']/Int[@Name='Length']"/>):</td>
222                 <td>
223                     <xsl:call-template name="SequenceAsCSV">
224                         <xsl:with-param name="root" select="Sequence[@Name='Atoms']"/>
225                     </xsl:call-template>
226                 </td>
227             </tr>
228         </xsl:if>
229     </table>
230     <xsl:apply-templates select="Sequence[@Name='Positions']"/>
231 </xsl:template>
232
233 <xsl:template match="Selection/Sequence[@Name='Positions']">
234     <p>
235         Positions (count: <xsl:value-of select="Int[@Name='Length']"/>):
236         <table border="1">
237             <tr>
238                 <xsl:if test="Position/Sequence[@Name='Atoms']">
239                     <th>Atom count</th>
240                     <th>Atoms</th>
241                 </xsl:if>
242                 <xsl:if test="Position/Int[@Name='RefId']">
243                     <th>RefId</th>
244                     <th>MappedId</th>
245                 </xsl:if>
246                 <xsl:if test="Position/Vector[@Name='Coordinates']">
247                     <th>Coordinates</th>
248                 </xsl:if>
249                 <xsl:if test="Position/Real[@Name='Mass']">
250                     <th>Mass</th>
251                 </xsl:if>
252                 <xsl:if test="Position/Real[@Name='Charge']">
253                     <th>Charge</th>
254                 </xsl:if>
255             </tr>
256             <xsl:for-each select="Position">
257             <tr>
258                 <xsl:if test="Sequence[@Name='Atoms']">
259                     <td><xsl:value-of select="Sequence[@Name='Atoms']/Int[@Name='Length']"/></td>
260                     <td>
261                         <xsl:call-template name="SequenceAsCSV">
262                             <xsl:with-param name="root" select="Sequence[@Name='Atoms']"/>
263                         </xsl:call-template>
264                     </td>
265                 </xsl:if>
266                 <xsl:if test="Int[@Name='RefId']">
267                     <td><xsl:value-of select="Int[@Name='RefId']"/></td>
268                     <td><xsl:value-of select="Int[@Name='MappedId']"/></td>
269                 </xsl:if>
270                 <xsl:if test="Vector[@Name='Coordinates']">
271                     <td>
272                         <xsl:apply-templates select="Vector[@Name='Coordinates']"/>
273                     </td>
274                 </xsl:if>
275                 <xsl:if test="Real[@Name='Mass']">
276                     <td><xsl:value-of select="Real[@Name='Mass']"/></td>
277                 </xsl:if>
278                 <xsl:if test="Real[@Name='Charge']">
279                     <td><xsl:value-of select="Real[@Name='Charge']"/></td>
280                 </xsl:if>
281             </tr>
282             </xsl:for-each>
283         </table>
284     </p>
285 </xsl:template>
286
287 </xsl:stylesheet>