| 1 | = T3D Technical Documentation = |
| 2 | |
| 3 | This documentation serves as a technical and development reference for maintenance and further development. |
| 4 | |
| 5 | == Functioning == |
| 6 | |
| 7 | The HTML documentation is created in 2 steps: |
| 8 | {{{ |
| 9 | #!html |
| 10 | <div style="padding-left:20px;"> |
| 11 | <img width=100% src="http://www.trex.informatik.uni-goettingen.de/etsicheck2/raw-attachment/wiki/Documentation/Development/T3D/tecdoc3.png"/> |
| 12 | </div> |
| 13 | }}} |
| 14 | [[BR]] |
| 15 | First, the TTCN-3 files are parsed and the information required for step two is written into XML files. These files are then used to generate the HTML files via XSL-Stylesheets. The XSL-Transformations are done by the Saxon XSLT Processor. |
| 16 | |
| 17 | === Creating the XML Files === |
| 18 | TTCN-3 trees are generated by TRex and are then traversed by '''Visitors''' which gather all relevant information to be written into the XML files. The '''Visitors''' are instantiated for every TTCN-3 file: |
| 19 | {{{ |
| 20 | #!html |
| 21 | <div style="padding-left:20px;"> |
| 22 | <img width=100% src="http://www.trex.informatik.uni-goettingen.de/etsicheck2/raw-attachment/wiki/Documentation/Development/T3D/tecdoc2.png"/> |
| 23 | </div> |
| 24 | }}} |
| 25 | [[BR]] |
| 26 | |
| 27 | ==== Visitors ==== |
| 28 | There are currently 3 Visitors:[[BR]] |
| 29 | - '''T3DVisior''' - gathers information used to generate the '''project.xml''' |
| 30 | - '''!DependencyVisitor''' - gathers information used to generate the '''dependencies.xml''' |
| 31 | - '''!ImportVisitor''' - gathers information used to generate the '''imports.xml''' |
| 32 | |
| 33 | ===== Creating new Visitors ===== |
| 34 | To create a new Visitor to implement new functionalities or to gather new information from the TTCN-3 files, the following code can be used. |
| 35 | |
| 36 | '' Basic structure of the new Visitor: '' |
| 37 | {{{ |
| 38 | package org.etsi.t3d.visitor; |
| 39 | |
| 40 | import de.ugoe.cs.swe.trex.core.analyzer.rfparser.LocationAST; |
| 41 | |
| 42 | public class NewVisitor extends AbstractVisitor { |
| 43 | @Override |
| 44 | public void finish() { |
| 45 | } |
| 46 | |
| 47 | @Override |
| 48 | public void init() { |
| 49 | } |
| 50 | |
| 51 | /* |
| 52 | visitNodeType(LocationAST node) functions |
| 53 | */ |
| 54 | } |
| 55 | }}} |
| 56 | '' visitNodeType(LocationAST node) '' functions are called when nodes of certain types are traversed. For example, '' visitFunctionDef(LocationAST node) '' is called when a '' !FunctionDef '' node is found. This node is represented by the '' node '' parameter. See '' !AbstractVisitor.java '' for a full list of those functions. |
| 57 | ====== Adding the new Visitor to T3D.java ====== |
| 58 | The following code shows where to implement the new Visitor in T3D.java, so it will function properly.[[BR]][[BR]] |
| 59 | '' T3D.java: '' |
| 60 | {{{ |
| 61 | /* ... */ |
| 62 | public void run(String[] args) { |
| 63 | /* ... */ |
| 64 | for (int i = 0; i < ttcn3Resources.size(); i++) { |
| 65 | analyzer = analyzerFactory.getTTCN3Analyzer(ttcn3Resources.get(i)); |
| 66 | T3DVisitor visitor = new T3DVisitor(xmlPrinter); |
| 67 | DependencyVisitor dependencyVisitor = new DependencyVisitor(depPrinter); |
| 68 | ImportVisitor importVisitor = new ImportVisitor(importPrinter); |
| 69 | |
| 70 | NewVisitor newVisitor = new NewVisitor(); |
| 71 | // ... |
| 72 | newVisitor.acceptDFS((LocationAST) analyzer.getParser().getAST()); |
| 73 | // ... |
| 74 | } |
| 75 | /* ... */ |
| 76 | } |
| 77 | /* ... */ |
| 78 | }}} |
| 79 | |
| 80 | ==== Structure of the generated XML files ==== |
| 81 | |
| 82 | ===== project.xml ===== |
| 83 | This file contains the most comprehensive information and represents an abstracted version of the source TTCN-3 files, including module structure, the individual elements, their bodies (if configured so), and T3Doc comments for every module, group, and element of the processed TTCN-3 files. It serves as a basis for the main and the module parameter / test case views. |
| 84 | |
| 85 | [[BR]][[BR]]DTD: |
| 86 | {{{ |
| 87 | <!ELEMENT project (module, element, group)*> |
| 88 | <!ELEMENT module (name, comment?, behaviour, modulename, import*)> |
| 89 | <!ELEMENT group (name, location, comment?, behaviour, modulename, path)> |
| 90 | <!ELEMENT element (name, location, comment?, behaviour, modulename, mpview_ModuleParDef?, path)> |
| 91 | <!ATTLIST element type CDATA #REQUIRED> |
| 92 | |
| 93 | <!ELEMENT path (path_group)> |
| 94 | <!ELEMENT path_group (path_group)> |
| 95 | <!ATTLIST path_group loc CDATA #REQUIRED name CDATA #REQUIRED> |
| 96 | <!-- |
| 97 | Contains information on which groups an element or group belongs to |
| 98 | <path> |
| 99 | <path_group loc="..." name="subsubgroup"> |
| 100 | <path_group loc="..." name="subgroup"> |
| 101 | <path_group loc="..." name="group"> |
| 102 | </path_group> |
| 103 | </path_group> |
| 104 | </path_group> |
| 105 | <path> |
| 106 | --> |
| 107 | |
| 108 | <!ELEMENT mpview_ModuleParDef((mpview_TestcaseDef | mpview_FunctionDef | mpview_AltstepDef)*) |
| 109 | <!ELEMENT mpview_FunctionDef((mpview_TestcaseDef | mpview_FunctionDef | mpview_AltstepDef)*) |
| 110 | <!ELEMENT mpview_TestcaseDef((mpview_TestcaseDef | mpview_FunctionDef | mpview_AltstepDef)*) |
| 111 | <!ELEMENT mpview_AltstepDef((mpview_TestcaseDef | mpview_FunctionDef | mpview_AltstepDef)*) |
| 112 | <!ATTLIST mpview_ModuleParDef loc CDATA #REQUIRED name CDATA #REQUIRED> |
| 113 | <!ATTLIST mpview_FunctionDef loc CDATA #REQUIRED name CDATA #REQUIRED> |
| 114 | <!ATTLIST mpview_TestcaseDef loc CDATA #REQUIRED name CDATA #REQUIRED> |
| 115 | <!ATTLIST mpview_AltstepDef loc CDATA #REQUIRED name CDATA #REQUIRED> |
| 116 | <!-- contains information on how module parameters are connected to testcases --> |
| 117 | |
| 118 | <!ELEMENT behaviour (#PCDATA | keyword | constructbody | link)*> |
| 119 | <!ELEMENT constructbody (#PCDATA | keyword | link)*> |
| 120 | <!ATTLIST constructbody id CDATA #REQUIRED> |
| 121 | <!ELEMENT keyword (#PCDATA)> |
| 122 | <!-- <keyword> elements are used around keywords of TTCN3 like "function" --> |
| 123 | <!-- <link> elements are used to identifiy crossreferences --> |
| 124 | <!-- the <constructbody> tag surrounds the parts of the behaviour which can be toggled in the HTML documentation --> |
| 125 | |
| 126 | <!ELEMENT link (#PCDATA)> |
| 127 | <!ATTLIST link loc CDATA #REQUIRED> |
| 128 | |
| 129 | <!ELEMENT newline EMPTY> |
| 130 | <!ELEMENT tab EMPTY> |
| 131 | |
| 132 | <!ELEMENT name (#PCDATA)> |
| 133 | <!ELEMENT location (#PCDATA)> |
| 134 | |
| 135 | <!ELEMENT comment (author | config | desc | exception | member | param | purpose | remark |
| 136 | | return | see | since | status | url | verdict | version)*> |
| 137 | <!-- @version 2.0.1 ist stored as <version>2.0.1</version> --> |
| 138 | |
| 139 | <!ELEMENT author (#PCDATA | esee | eurl)*> |
| 140 | <!ELEMENT config (#PCDATA | esee | eurl)*> |
| 141 | <!ELEMENT desc (#PCDATA | esee | eurl)*> |
| 142 | <!ELEMENT exception (#PCDATA | esee | eurl)*> |
| 143 | <!ELEMENT purpose (#PCDATA | esee | eurl)*> |
| 144 | <!ELEMENT param (#PCDATA | esee | eurl)*> |
| 145 | <!ELEMENT remark (#PCDATA | esee | eurl)*> |
| 146 | <!ELEMENT return (#PCDATA | esee | eurl)*> |
| 147 | <!ELEMENT see (#PCDATA)> |
| 148 | <!ELEMENT since (#PCDATA | esee | eurl)*> |
| 149 | <!ELEMENT status (#PCDATA | esee | eurl)*> |
| 150 | <!ELEMENT url (#PCDATA | esee | eurl)*> |
| 151 | <!ELEMENT verdict (#PCDATA | esee | eurl)*> |
| 152 | <!ELEMENT version (#PCDATA | esee | eurl)*> |
| 153 | <!ELEMENT member (#PCDATA | esee | eurl)*> |
| 154 | |
| 155 | <!ELEMENT esee (#PCDATA)> |
| 156 | <!ELEMENT eurl (#PCDATA)> |
| 157 | }}} |
| 158 | ====== Examples ====== |
| 159 | {{{ |
| 160 | #!html |
| 161 | <table border="1"> |
| 162 | <tr> |
| 163 | <th></th> |
| 164 | <th>TTCN-3</th> |
| 165 | <th>XML</th> |
| 166 | </tr> |
| 167 | <tr> |
| 168 | <td>Behaviour</td> |
| 169 | <td> |
| 170 | <pre style="white-space: pre-wrap;"> |
| 171 | testcase tc2() runs on sampleComponent1 system sampleComponent3{ |
| 172 | map(mtc:p1, system:p1) |
| 173 | var sampleComponent2 component2, component3; |
| 174 | component2 := sampleComponent2.create; |
| 175 | component3 := sampleComponent2.create; |
| 176 | component2.start(f3()); |
| 177 | component3.start(f4(1, "a")); |
| 178 | unmap(mtc:p1, system:p1) |
| 179 | } |
| 180 | </pre> |
| 181 | </td> |
| 182 | <td> |
| 183 | <pre style="white-space: pre-wrap;"> |
| 184 | <behaviour><keyword>testcase</keyword> <link loc="testcases-tc2-328.html">tc2</link> () |
| 185 | <keyword>runs</keyword> <keyword>on</keyword> <link loc="configuration-sampleComponent1-235.html">sampleComponent1</link> |
| 186 | <keyword>system</keyword> <link loc="configuration-sampleComponent3-365.html">sampleComponent3</link> <constructbody id="id319">{ |
| 187 | <keyword>map</keyword> ( mtc:p1, system:p1 ) |
| 188 | <keyword>var</keyword> <link loc="configuration-sampleComponent2-455.html">sampleComponent2</link> component2, component3; |
| 189 | component2 := sampleComponent2.create; |
| 190 | component3 := sampleComponent2.create; |
| 191 | component2.start ( <link loc="functions-f3-1119.html">f3</link> () ); |
| 192 | component3.start ( <link loc="functions-f4-1347.html">f4</link> ( 1, "a" ) ); |
| 193 | <keyword>unmap</keyword> ( mtc:p1, system:p1 ) |
| 194 | }</constructbody> |
| 195 | </behaviour> |
| 196 | </pre> |
| 197 | </td> |
| 198 | </tr> |
| 199 | <tr> |
| 200 | <td>Path</td> |
| 201 | <td> |
| 202 | <pre style="white-space: pre-wrap;"> |
| 203 | group group1{ |
| 204 | group group1_1{ |
| 205 | group group1_1_1{ |
| 206 | //... |
| 207 | } |
| 208 | } |
| 209 | } |
| 210 | </pre> |
| 211 | </td> |
| 212 | <td> |
| 213 | <pre style="white-space: pre-wrap;"> |
| 214 | <path> |
| 215 | <path_group loc="groupTest-group1_1_1-341.html" name="group1_1_1"> |
| 216 | <path_group loc="groupTest-group1_1-321.html" name="group1_1"> |
| 217 | <path_group loc="groupTest-group1-304.html" name="group1"> |
| 218 | </path_group> |
| 219 | </path_group> |
| 220 | </path_group> |
| 221 | </path> |
| 222 | </pre> |
| 223 | </td> |
| 224 | </tr> |
| 225 | </table> |
| 226 | }}} |
| 227 | |
| 228 | ===== import.xml ===== |
| 229 | This file contains information about the imports and dependency relations of the processed TTCN-3 modules. It serves as a basis for the import / module dependency view. |
| 230 | |
| 231 | [[BR]][[BR]]DTD: |
| 232 | {{{ |
| 233 | <!ELEMENT imports module*> |
| 234 | <!ELEMENT module import*> |
| 235 | <!ELEMENT import (import_behaviour, import*) | EMPTY> |
| 236 | <!ATTLIST import name CDATA #REQUIRED> |
| 237 | <!ELEMENT import_behaviour (#PCDATA | link)*> |
| 238 | <!ELEMENT link (#PCDATA)> |
| 239 | <!ATTLIST link loc CDATA #REQUIRED> |
| 240 | }}} |
| 241 | |
| 242 | ===== dependencies.xml ===== |
| 243 | This file can be thought of as a blend between an abstracted version of the main project.xml file and a low-level version of the import.xml file, featuring a compact representation of the low-level dependencies at the module definition (element) level - it contains all the module definitions and all the known elements referenced directly within each module definition. There is no separate view associated to this file, since it is basically a compact representation of the main view and its main intent is the use with third-party tools to perform custom tasks, such as slicing or markup of definitions related to a particular module definition (e.g. approved / locked definitions, etc.). |
| 244 | |
| 245 | [[BR]][[BR]]DTD: |
| 246 | {{{ |
| 247 | <!ELEMENT dependencies element*> |
| 248 | <!ELEMENT element reflist> |
| 249 | <!ATTLIST element id ID #REQUIRED, |
| 250 | type CDATA #REQUIRED |
| 251 | line CDATA #REQUIRED |
| 252 | module CDATA #REQUIRED> |
| 253 | <!ELEMENT reflist ref*> |
| 254 | <!ELEMENT ref EMPTY> |
| 255 | <!ATTLIST ref id IDREF #REQUIRED> |
| 256 | }}} |
| 257 | |
| 258 | |
| 259 | ===== log.xml ===== |
| 260 | This file contains all informations, warnings and errors for each TTCN-3 module that are logged by T3D. |
| 261 | |
| 262 | [[BR]][[BR]]DTD: |
| 263 | {{{ |
| 264 | <!ELEMENT t3dlog file*> |
| 265 | <!ATTLIST t3dlog t3dversion CDATA #REQUIRED> |
| 266 | |
| 267 | <!ELEMENT file (warning | error )*> |
| 268 | <!ATTLIST file path CDATA #REQUIRED> |
| 269 | |
| 270 | <!ELEMENT warning #PCDATA> |
| 271 | <!ATTLIST warning level CDATA #REQUIRED |
| 272 | lines CDATA #REQUIRED> |
| 273 | |
| 274 | <!ELEMENT error #PCDATA> |
| 275 | <!ATTLIST error level CDATA #REQUIRED |
| 276 | lines CDATA #REQUIRED> |
| 277 | }}} |
| 278 | |
| 279 | |
| 280 | === Generation of HTML files === |
| 281 | The HTML documentation is generated with the '''project.xml''' and the '''imports.xml''': |
| 282 | {{{ |
| 283 | #!html |
| 284 | <div style="padding-left:20px;"> |
| 285 | <img width=100% src="http://www.trex.informatik.uni-goettingen.de/etsicheck2/raw-attachment/wiki/Documentation/Development/T3D/tecdoc.png"/> |
| 286 | </div> |
| 287 | }}} |
| 288 | [[BR]] |
| 289 | The ''' Main View ''' and ''' Module Parameter/Testcase View ''' of the documentation are generated with the ''' html.xsl ''' stylesheet using the ''' project.xml ''' and the ''' Import View ''' is generated with the ''' html_import.xsl ''' stylesheet using the ''' imports.xml '''. |
| 290 | |
| 291 | ==== Structure of the XSL-stylesheets ==== |
| 292 | Below, the structure and templates of the XSL-Stylesheets are described to simplify making modifications. See {$T3D_HOME}/css/doc.css for descriptions of the HTML elements. |
| 293 | |
| 294 | ===== html.xsl ===== |
| 295 | |
| 296 | Structure of the html.xsl: |
| 297 | {{{ |
| 298 | <xsl:stylesheet> |
| 299 | <xsl:template match="/"> |
| 300 | <xsl:result-document href="..." format="html"> |
| 301 | <!-- generates index.html --> |
| 302 | </xsl:result-document> |
| 303 | |
| 304 | <xsl:result-document href="..." format="html"> |
| 305 | <!-- generates import_index.html --> |
| 306 | </xsl:result-document> |
| 307 | |
| 308 | <xsl:result-document href="..." format="html"> |
| 309 | <!-- generates mp_index.html --> |
| 310 | </xsl:result-document> |
| 311 | |
| 312 | <xsl:for-each select="//module"> |
| 313 | <xsl:variable name="currentmodule" select="name/text()"/> |
| 314 | <xsl:variable name="currentindex"> |
| 315 | <!--...--> |
| 316 | </xsl:variable> |
| 317 | <xsl:variable name="currentmp_index"> |
| 318 | <!--...--> |
| 319 | </xsl:variable> |
| 320 | |
| 321 | <xsl:result-document href="..." format="html"> |
| 322 | <!-- generates Main View Documentation of modules --> |
| 323 | </xsl:result-document> |
| 324 | |
| 325 | <xsl:result-document href="..." format="html"> |
| 326 | <!-- generates MP/TC View Documentation of modules --> |
| 327 | </xsl:result-document> |
| 328 | |
| 329 | <xsl:for-each select="//element[modulename/text() eq $currentmodule]"> |
| 330 | <xsl:result-document href="..." format="html"> |
| 331 | <!-- generates Main View Documentation of elements --> |
| 332 | </xsl:result-document> |
| 333 | |
| 334 | <xsl:if test="@type eq 'testcase'"> |
| 335 | <xsl:result-document href="..." format="html"> |
| 336 | <!-- generates MP/TC View Documentation of testcases --> |
| 337 | </xsl:result-document> |
| 338 | </xsl:if> |
| 339 | |
| 340 | <xsl:if test="@type eq 'parameter'"> |
| 341 | <xsl:result-document href="..." format="html"> |
| 342 | <!-- generates MP/TC View Documentation of module parameters --> |
| 343 | </xsl:result-document> |
| 344 | </xsl:if> |
| 345 | </xsl:for-each> |
| 346 | </xsl:for-each> |
| 347 | |
| 348 | <xsl:for-each select="//group"> |
| 349 | <xsl:result-document href="..." format="html"> |
| 350 | <!-- generates Main View Documentation of groups --> |
| 351 | </xsl:result-document> |
| 352 | |
| 353 | <xsl:result-document href="..." format="html"> |
| 354 | <!-- generates MP/TC View Documentation of groups --> |
| 355 | </xsl:result-document> |
| 356 | </xsl:for-each> |
| 357 | </xsl:template> |
| 358 | |
| 359 | <!-- |
| 360 | Templates |
| 361 | --> |
| 362 | |
| 363 | </xsl:stylesheet |
| 364 | }}} |
| 365 | [[BR]] |
| 366 | The following table contains descriptions of parameters and function of the used XSLT templates in ''' html.xsl '''. |
| 367 | |
| 368 | {{{ |
| 369 | #!html |
| 370 | <table border="1"> |
| 371 | <tr> |
| 372 | <th>Template</th><th>Parameters</th><th>Function</th> |
| 373 | </tr> |
| 374 | <tr> |
| 375 | <td><b>main_allElements</b></td> |
| 376 | <td><b>$this</b> = module|group|element<br/> |
| 377 | <b>$currentindex</b> = complete construct index |
| 378 | </td> |
| 379 | <td>calls <b>views</b> template<br/> |
| 380 | inserts <b>$currentindex</b><br/> |
| 381 | calls <b>header</b> template<br/> |
| 382 | calls <b>element_withcomment</b> template |
| 383 | </td> |
| 384 | </tr> |
| 385 | <tr> |
| 386 | <td><b>mp_allTables</b></td> |
| 387 | <td><b>$testcases</b> = testcases<br/> |
| 388 | <b>$parameters</b> = parameters |
| 389 | </td> |
| 390 | <td>generates <b>div_mp</b> element for groups, modules and the MP/TC index</td> |
| 391 | </tr> |
| 392 | <tr> |
| 393 | <td><b>html_head</b></td> |
| 394 | <td><b>$title</b> = title of page</td> |
| 395 | <td>generates <b>head</b> element</td> |
| 396 | </tr> |
| 397 | <tr> |
| 398 | <td><b>views</b></td> |
| 399 | <td><b>$main</b> = location of Main View documentation of the current element</br> |
| 400 | <b>$mp</b> = location of MP/TC View documentation of the current element</br> |
| 401 | <b>$import</b> = location of Import View documentation of the current element</br> |
| 402 | <b>$togglemode</b> |
| 403 | </td> |
| 404 | <td>generates <b>div_views</b> element and <b>T3D Generation Stamp</b></td> |
| 405 | </tr> |
| 406 | <tr> |
| 407 | <td><b>main_index</b></td> |
| 408 | <td><b>$modulename</b> = name of the current module</td> |
| 409 | <td>generates <b>div_modules</b> element<br/> |
| 410 | generates <b>div_index</b> element of the Main View of modules, elements and the index |
| 411 | </td> |
| 412 | </tr> |
| 413 | <tr> |
| 414 | <td><b>main_groupindex</b></td> |
| 415 | <td><b>$grouplocation</b> = location of the current group</td> |
| 416 | <td>generates <b>div_modules</b> element<br/> |
| 417 | generates <b>div_index</b> of the Main View of groups |
| 418 | </td> |
| 419 | </tr> |
| 420 | <tr> |
| 421 | <td><b>index_grouplist</b></td> |
| 422 | <td><b>$this</b> = groups</br> |
| 423 | <b>$prefix</b> = '' or 'mp_' |
| 424 | </td> |
| 425 | <td>generates list of hyperlinks to all groups given in parameter <b>$this</b></td> |
| 426 | </tr> |
| 427 | <tr> |
| 428 | <td><b>index_elementlist</b></td> |
| 429 | <td><b>$this</b> = elements</br> |
| 430 | <b>$prefix</b> = '' or 'mp_'</br> |
| 431 | <b>$type</b> = type of elements |
| 432 | </td> |
| 433 | <td>generates list of hyperlinks to all elements given in parameter <b>$this</b></td> |
| 434 | </tr> |
| 435 | <tr> |
| 436 | <td><b>mp_index</b></td> |
| 437 | <td><b>$modulename</b> = name of the current module</td> |
| 438 | <td>generates <b>div_modules</b> element<br/> |
| 439 | generates <b>div_index</b> of the MP/TC View |
| 440 | </td> |
| 441 | </tr> |
| 442 | <tr> |
| 443 | <td><b>index_modulelist</b></td> |
| 444 | <td><b>$prefix</b> = '', 'mp_' or 'import_'</td> |
| 445 | <td>generates list of hyperlinks to all modules</td> |
| 446 | </tr> |
| 447 | <tr> |
| 448 | <td><b>header</b></td> |
| 449 | <td><b>$this</b> = module|group|element<br/> |
| 450 | <b>$prefix</b> = '', 'mp_' or 'import_' |
| 451 | </td> |
| 452 | <td>generates <b>p_header</b> element</td> |
| 453 | </tr> |
| 454 | <tr> |
| 455 | <td><b>element_withcomment</b></td> |
| 456 | <td><b>$this</b> = module|group|element</td> |
| 457 | <td>generates <b>div_content</b> element<br/> |
| 458 | generates <b>div_comment</b> element<br/> |
| 459 | generates <b>div_element</b> element |
| 460 | </td> |
| 461 | </tr> |
| 462 | <tr> |
| 463 | <td><b>path</b></td> |
| 464 | <td><b>$this</b> = module|group|element</br> |
| 465 | <b>$prefix</b> = '', 'mp_' or 'import_'</td> |
| 466 | <td>calls <b>path_group</b> template |
| 467 | </td> |
| 468 | </tr> |
| 469 | <tr> |
| 470 | <td><b>path_group</b></td> |
| 471 | <td><b>$this</b> = module|group|element</br> |
| 472 | <b>$prefix</b> = '', 'mp_' or 'import_'</td> |
| 473 | <td>generates the group part of the path navigation |
| 474 | </td> |
| 475 | </tr> |
| 476 | <tr> |
| 477 | <td><b>mp_testcase_table</b></td> |
| 478 | <td><b>$this</b> = testcases</td> |
| 479 | <td>generates the MP/TC View table of testcase elements<br/> |
| 480 | </td> |
| 481 | </tr> |
| 482 | <tr> |
| 483 | <td><b>mpview_path_testcase</b></td> |
| 484 | <td><b>$this</b> = mpview_TestcaseDefs</br> |
| 485 | <b>$first</b> = true|false |
| 486 | </td> |
| 487 | <td>generates <b>Path</b> part of the MP/TC View table of testcase elements</td> |
| 488 | </tr> |
| 489 | <tr> |
| 490 | <td>match <b>mpview_ModuleParDef</b></td> |
| 491 | <td></td> |
| 492 | <td>generates the MP/TC View table of module parameter elements<br/> |
| 493 | </td> |
| 494 | </tr> |
| 495 | <tr> |
| 496 | <td><b>mpview_path_modulepar</b></td> |
| 497 | <td><b>$this</b> = module|group|element</br> |
| 498 | <b>$first</b> = true|false</td> |
| 499 | <td>generates <b>Path</b> part of the MP/TC View table of module parameter elements</td> |
| 500 | </tr> |
| 501 | </table> |
| 502 | }}} |
| 503 | ===== html_import.xsl ===== |
| 504 | The following table contains descriptions of parameters and function of the used XSLT templates in ''' html_import.xsl '''. |
| 505 | |
| 506 | {{{ |
| 507 | #!html |
| 508 | <table border="1"> |
| 509 | <tr> |
| 510 | <th>Template</th><th>Parameters</th><th>Function</th> |
| 511 | </tr> |
| 512 | <tr> |
| 513 | <td><b>import</b></td> |
| 514 | <td><b>$module</b> = name of the current module <br/> |
| 515 | <b>$importname</b> = name of imported module</td> |
| 516 | <td>generates a list of imports by <b>$module</b> from <b>$importname</b></td> |
| 517 | </tr> |
| 518 | <tr> |
| 519 | <td><b>importby</b></td> |
| 520 | <td><b>$imports</b> = list of indirect imports</td> |
| 521 | <td>generates a list of <b>$imports</b></td> |
| 522 | </tr> |
| 523 | <tr> |
| 524 | <td><b>show_imports</b></td> |
| 525 | <td><b>$module</b> = module<br/> |
| 526 | <b>$currentmodule</b> = currently selected module</td> |
| 527 | <td>selects a color for <b>$currentmodule</b> and calls the <b>colored_module</b> template</td> |
| 528 | </tr> |
| 529 | <tr> |
| 530 | <td><b>colored_module</b></td> |
| 531 | <td><b>$module</b> = module<br/> |
| 532 | <b>$color</b> = class of <b>$module</b></td> |
| 533 | <td>generates a colored hyperlink to <b>$currentmodule</b> (used for list of modules in the middle column)</b> |
| 534 | </td> |
| 535 | </tr> |
| 536 | <tr> |
| 537 | <td><b>html_head</b></td> |
| 538 | <td><b>$title</b> = title of page</td> |
| 539 | <td>generates <b>head</b> element</td> |
| 540 | </tr> |
| 541 | <tr> |
| 542 | <td><b>legend</b></td> |
| 543 | <td></td> |
| 544 | <td>generates Import View Legend</td> |
| 545 | </tr> |
| 546 | </table> |
| 547 | }}} |
| 548 | |
| 549 | ==== Using new XSL-Stylesheets and/or XML files ==== |
| 550 | New XSL-Transformations can be executed by using the following code.[[BR]] |
| 551 | '' XSL-Transformation: '' |
| 552 | {{{ |
| 553 | String foldername = getProperOutputPath() + "/" + getSubPath(); |
| 554 | String xmlFileName = "name.xml"; |
| 555 | String xsltFileName = "name.xsl"; |
| 556 | String outputFileName = "outputName"; |
| 557 | |
| 558 | System.setProperty("javax.xml.transform.TransformerFactory", "net.sf.saxon.TransformerFactoryImpl"); |
| 559 | TransformerFactory tfactory = TransformerFactory.newInstance(); |
| 560 | Transformer transformer; |
| 561 | try { |
| 562 | transformer = tfactory.newTransformer(new StreamSource(new File(xsltFileName))); |
| 563 | //transformer.setParameter("parameterName", <parameterValue>); |
| 564 | |
| 565 | transformer.transform(new StreamSource(new File(foldername + "/" + xmlFileName)), |
| 566 | new StreamResult(new FileOutputStream(foldername + "/" + outputFileName))); |
| 567 | } catch (TransformerConfigurationException e) { |
| 568 | e.printStackTrace(); |
| 569 | } catch (TransformerException e) { |
| 570 | e.printStackTrace(); |
| 571 | } catch (FileNotFoundException e) { |
| 572 | e.printStackTrace(); |
| 573 | } |
| 574 | }}} |
| 575 | |
| 576 | |
| 577 | === Javascript === |
| 578 | To toggle the visibility of certain elements in the HTMl documentation (e.g. navigation items), a Javascript file called '' doc.js '' is used. It can be found in {$T3D_HOME}/js. |
| 579 | [[BR]] |
| 580 | ==== Functions ==== |
| 581 | The Javascript file consists of the following functions: |
| 582 | - ''' getElementsByClass(searchClass,node,tag) ''': returns all HTML elements of a certain class |
| 583 | - ''' toggleConstructbodies(hide) ''': toggles visibility of all construct bodies in the Main View of elements/groups/modules if hide == true |
| 584 | - ''' toggleImportDetails() ''': toggles visibility of all details in the Import View of a module |
| 585 | - ''' togglePaths(hide) ''': toggles visibility of all Path columns in the MP/TC View of module parameters/test cases/groups/modules if hide == true |
| 586 | - ''' toggleHideNotes() ''': toggles visibility of all '' (toggle) '' notes in the Main View of elements/groups/modules |
| 587 | - ''' toggleElement(element) ''': toggles the visibility of '' element '' |
| 588 | - ''' toggle(elementName) ''': calls ''' toggleElement() ''' with the element with the Id '' elementName '' |
| 589 | - ''' mp_init(listName) ''': collapses all construct lists in the construct index of the MP/TC View, except '' listName '' |
| 590 | - ''' init(listName) ''': calls ''' toggleHideNotes() ''' and collapses all construct lists in the construct index of the Main View, except '' listName '' |