Bachelorarbeit Documentation Generation for TTCN-3 filefor automatic documentation generation from...

65
Georg-August-Universit¨ at ottingen Zentrum f¨ ur Informatik ISSN 1612-6793 Nummer ZFI-BSC-2009-06 Bachelorarbeit im Studiengang ”Angewandte Informatik” Documentation Generation for TTCN-3 Stefan Kirchner am Institut f¨ ur Informatik Gruppe Softwaretechnik f¨ ur Verteilte Systeme Bachelor- und Masterarbeiten des Zentrums f¨ ur Informatik an der Georg-August-Universit¨ at G¨ ottingen 17. August 2009

Transcript of Bachelorarbeit Documentation Generation for TTCN-3 filefor automatic documentation generation from...

Page 1: Bachelorarbeit Documentation Generation for TTCN-3 filefor automatic documentation generation from TTCN-3 source code using a standardized ... Softwaredokumentation ist ein wichtiger

Georg-August-UniversitatGottingenZentrum fur Informatik

ISSN 1612-6793Nummer ZFI-BSC-2009-06

Bachelorarbeitim Studiengang ”Angewandte Informatik”

Documentation Generation for TTCN-3

Stefan Kirchner

am Institut fur Informatik

Gruppe Softwaretechnik fur Verteilte Systeme

Bachelor- und Masterarbeitendes Zentrums fur Informatik

an der Georg-August-Universitat Gottingen

17. August 2009

Page 2: Bachelorarbeit Documentation Generation for TTCN-3 filefor automatic documentation generation from TTCN-3 source code using a standardized ... Softwaredokumentation ist ein wichtiger

Georg-August-Universitat GottingenZentrum fur Informatik

Goldschmidtstraße 737083 GottingenGermany

Tel. +49 (5 51) 39-1 72000

Fax +49 (5 51) 39-1 44 03

Email [email protected]

WWW www.ifi.informatik.uni-goettingen.de

Page 3: Bachelorarbeit Documentation Generation for TTCN-3 filefor automatic documentation generation from TTCN-3 source code using a standardized ... Softwaredokumentation ist ein wichtiger

Ich erklare hiermit, dass ich die vorliegende Arbeit selbstandig verfasst und keineanderen als die angegebenen Quellen und Hilfsmittel verwendet habe.

Gottingen, den 17. August 2009

Page 4: Bachelorarbeit Documentation Generation for TTCN-3 filefor automatic documentation generation from TTCN-3 source code using a standardized ... Softwaredokumentation ist ein wichtiger
Page 5: Bachelorarbeit Documentation Generation for TTCN-3 filefor automatic documentation generation from TTCN-3 source code using a standardized ... Softwaredokumentation ist ein wichtiger

Bachelor’s Thesis

Documentation Generation for TTCN-3

Stefan Kirchner

August 17, 2009

Supervised by Prof. Dr. Jens GrabowskiSoftware Engineering for Distributed Systems Group

Institute for Computer ScienceGeorg-August University of Gottingen, Germany

Page 6: Bachelorarbeit Documentation Generation for TTCN-3 filefor automatic documentation generation from TTCN-3 source code using a standardized ... Softwaredokumentation ist ein wichtiger

Abstract

Software documentation is a very important part of software engineering. It is writtentext that helps to understand the documented software. This thesis presents an approachfor automatic documentation generation from TTCN-3 source code using a standardizeddocumentation comment specification. XSL Transformations to the output formats HTMLand PDF that use T3DocML — an intermediate XML format that abstracts from TTCN-3for documentation purposes which was developed in the course of this thesis — are described.A prototypical implementation of the proposed approach, that was successfully tested onseveral TTCN-3 test suites by ETSI, is presented in this thesis.

Zusammenfassung

Softwaredokumentation ist ein wichtiger Bestandteil der Software-Technik. Sie istgeschriebener Text, der dabei hilft, die dokumentierte Software zu verstehen. Diese Ar-beit prasentiert einen Ansatz zur automatischen Dokumentationsgenerierung aus TTCN-3Source Code mit Hilfe einer standardisierten Spezifikation fur Dokumentationskommentare.XSL-Transformationen in die Ausgabeformate HTML und PDF unter Benutzung vonT3DocML — einem XML-Zwischenformat, dessen Struktur von TTCN-3 abstrahiert undim Verlaufe dieser Arbeit entwickelt wurde — werden beschrieben. Eine prototypische Im-plementierung des vorgestellten Ansatzes, welche erfolgreich an diversen TTCN-3 Testsuitenvon ETSI getestet wurde, wird in dieser Arbeit prasentiert.

Keywords: TTCN-3, T3Doc, T3DocML, Documentation, XSLT, XSL-FO

Page 7: Bachelorarbeit Documentation Generation for TTCN-3 filefor automatic documentation generation from TTCN-3 source code using a standardized ... Softwaredokumentation ist ein wichtiger

Contents

1 Introduction 5

2 Foundations 62.1 Testing and Test Control Notation Version 3 (TTCN-3) . . . . . . . . . . . . 62.2 TTCN-3 Documentation Comment Specification . . . . . . . . . . . . . . . . 82.3 Extensible Markup Language (XML) . . . . . . . . . . . . . . . . . . . . . . . 10

2.3.1 XML Schema Definition . . . . . . . . . . . . . . . . . . . . . . . . . . 122.3.2 Extensible Stylesheet Language Transformations (XSLT) . . . . . . . 132.3.3 Extensible Stylesheet Language Formatting Objects (XSL-FO) . . . . 15

3 Documentation Transformations 173.1 Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

3.1.1 HTML Output Requirements . . . . . . . . . . . . . . . . . . . . . . . 173.1.2 PDF Output Requirements . . . . . . . . . . . . . . . . . . . . . . . . 19

3.2 Approach . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203.3 The T3DocML Schema . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203.4 Transforming T3DocML to HTML . . . . . . . . . . . . . . . . . . . . . . . . 23

3.4.1 Navigation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233.4.2 Source Code and Comments . . . . . . . . . . . . . . . . . . . . . . . . 253.4.3 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25

3.5 Transforming T3DocML to XSL-FO . . . . . . . . . . . . . . . . . . . . . . . 26

4 Implementation 284.1 Building T3DocML from TTCN-3 . . . . . . . . . . . . . . . . . . . . . . . . 28

4.1.1 The Classes Representing TTCN-3 Code . . . . . . . . . . . . . . . . . 294.1.2 Visitor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 314.1.3 XMLBuilder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 324.1.4 Processing the Comments . . . . . . . . . . . . . . . . . . . . . . . . . 33

4.2 Transforming T3DocML to HTML . . . . . . . . . . . . . . . . . . . . . . . . 344.3 Transforming T3DocML to PDF . . . . . . . . . . . . . . . . . . . . . . . . . 34

5 Conclusion 35

3

Page 8: Bachelorarbeit Documentation Generation for TTCN-3 filefor automatic documentation generation from TTCN-3 source code using a standardized ... Softwaredokumentation ist ein wichtiger

Contents

Bibliography 36

6 Acronyms 38

7 Annex 397.1 XML Schema . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 397.2 XSL Stylesheet - HTML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 437.3 XSL Stylesheet - XSL-FO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55

4

Page 9: Bachelorarbeit Documentation Generation for TTCN-3 filefor automatic documentation generation from TTCN-3 source code using a standardized ... Softwaredokumentation ist ein wichtiger

1 Introduction

Software testing is a very important part of software engineering. It provides informationabout the quality of the system under test (SUT). Software testing is conducted to findsoftware bugs or to verify if the SUT meets predefined requirements. The Testing and TestControl Notation Version 3 (TTCN-3) is one of several testing languages. It is internation-ally standardized and designed for defining test specifications. As software gets more andmore complex, so do test suites. TTCN-3’s wide acceptance and applicability has added tothe development of very large and complex TTCN-3 test suites, which must be maintainedand may need to be developed further. When developing or maintaining complex test suites,it is beneficial if they are well documented as software documentation also is an importantpart of software engineering. A documentation is written text that explains how to useor how to operate the documented software. Generating those documentations automati-cally from source code saves time and work. It also makes it faster to keep documentationsup-to-date, because changes in the source code only require to run the documentation toolagain.

This thesis is about an approach for the automatic generation of technical documentationfrom TTCN-3 source code. Technical documentations are reference manuals used in thesoftware development process for maintenance- and modification purposes as they describethe architecture of the software. They allow developers, testers and customers to quicklylook up any class or method.

Following this introduction, Chapter 2 presents the foundations of the technologies usedin this thesis. These technologies are TTCN-3, T3Doc, XML, XML Schema, XSLT, andXSL-FO. In Chapter 3, the requirements for the output formats HTML and PDF of thedocumentation are presented. Then, the approach of this thesis is described and T3DocMLis introduced. It is an XML format that is used to store the information about TTCN-3modules needed for the documentation. At last, transformations from T3DocML to theoutput formats are described using XSL stylesheets. Chapter 4 is about building T3DocMLfrom TTCN-3 source code and the implementation of the aforementioned transformationsin Java using Saxon and Apache FOP. Finally, the conclusion of this thesis is presented inChapter 5.

5

Page 10: Bachelorarbeit Documentation Generation for TTCN-3 filefor automatic documentation generation from TTCN-3 source code using a standardized ... Softwaredokumentation ist ein wichtiger

2 Foundations

In this chapter, the foundations of the technologies used in this thesis are presented. Section2.1 explains TTCN-3 [1]. The following section presents the foundations of T3Doc, whichprovides additional information for the documentation specification within TTCN-3. InSection 2.3, XML [2], XML Schema [3], and the XML-based technologies XSLT [4] andXSL-FO [5] are described.

2.1 Testing and Test Control Notation Version 3 (TTCN-3)

The Testing and Test Control Notation Version 3 (TTCN-3) [1, 6] was developed andpublished by the European Telecommunications Standards Institute (ETSI). It is an in-ternationally standardized programming language designed for defining test specifications.Compared to its predecessor, the Tree and Tabular Combined Notation Version 2 (TTCN-2)[7], it looks much more like a regular programming language. While TTCN-2 was mostlyused for testing communication systems, TTCN-3 can be used for a wide range of systems.

TTCN-3 code is organized in TTCN-3 modules. A module can contain definitions ofgroups, functions, testcases, altsteps, signatures, module parameters, templates,type definitions, and constants. These definitions can be imported by other modules.Modules can also contain an optional control part that contains information on how toexecute a test suite.

Groups are syntactically similar to modules and are used to structure TTCN-3 definitions.Groups can be imported from other modules, which allows for more selective importing.Other than that, they have little semantical significance.

Functions in TTCN-3 are used to store test code fragments that are, for example, oftenexecuted, in a reusable form. They work similar to functions in other programming lan-guages like Java and can be called by testcases, other functions, and the control part of amodule.

Testcases are descriptions of how a SUT is to be stimulated and what reactions areexpected. Based on those reactions a verdict (for example pass or fail) can be assigned.

Altsteps are named alternatives of alt statements that can be referred to in order toavoid code duplication. They are essentially functions for alt statements. Alt statementscontain alternatives that are executed based on responses of the SUT. For example, if thereis no response after a certain amount of time, the verdict of a testcase is set to fail, and ifthere is an expected response, the verdict is set to pass.

6

Page 11: Bachelorarbeit Documentation Generation for TTCN-3 filefor automatic documentation generation from TTCN-3 source code using a standardized ... Softwaredokumentation ist ein wichtiger

2 Foundations

Signatures represent methods of the SUT that can be remotely called by a TTCN-3 testsuite. They can have parameters, a return value and specify exceptions. Signatures areused to test procedure-based systems (for example, web services).

Module parameters are parameters given to a module to allow for a test suite to work indifferent environments — for example, by defining the address of a SUT as shown in Listing2.1. They can be used to provide external parameters at execution time.

0 modulepar {charstring sut ipAddres s }

Listing 2.1: TTCN-3 Example: Module Parameter

Templates are used for defining messages that are sent and received from the SUT andfor matching incoming values against their definition. They define values of a specific typeand can use wild cards. The template in Listing 2.2 defines the Bit values of the Byte type.Templates are used to test message-based, asynchronous systems.

0 template Byte seven := {1 b i t 1 := 0 ,2 // ...

3 b i t 6 := 1 ,4 b i t 7 := 1 ,5 b i t 8 := 16 }

Listing 2.2: TTCN-3 Example: Template

Types are defined by restrictions, sets, records, unions, or enumerations of built-in datatypes (for example, integer or charstring) or other user-defined types. Listing 2.3 showsan example of using the built-in data type integer to define a new type (Bit) that is usedin the definition of the Byte type — a record of Bits.

0 type integer Bit (0 . . 1 ) ;12 type record Byte {3 Bit bit1 ,4 Bit bit2 ,5 // ...

6 Bit b i t 87 }

Listing 2.3: TTCN-3 Example: Types

Constants are named values. Once defined, the value cannot be changed. Naming valuescan help to make TTCN-3 code easier to understand. Constants also provide a single pointof change if values need to be adjusted.

7

Page 12: Bachelorarbeit Documentation Generation for TTCN-3 filefor automatic documentation generation from TTCN-3 source code using a standardized ... Softwaredokumentation ist ein wichtiger

2 Foundations

2.2 TTCN-3 Documentation Comment Specification

The TTCN-3 Documentation Comment Specification [8] (also known and subsequently re-ferred to as T3Doc) specifies special documentation comments to be used in TTCN-3 sourcecode. These comments can be automatically processed to create documentation for the code.They are organized in documentation blocks and contain information about the TTCN-3element, module, or group they precede, for example the version of a testcase. A T3Doccomment is a valid TTCN-3 comment that starts with the“*”-character. Tagged paragraphsare used to make it easier for documentation tools to identify what kind of information isconveyed. The tagged paragraph given in Listing 2.4 contains information about the authorof the following TTCN-3 code by using the @author tag.

0 // ∗ @author John Doe

Listing 2.4: T3Doc Example: Tagged Paragraph

Listing 2.5 shows an example of a T3Doc documentation block using block commentsand tagged paragraphs. It contains information about the author(s) (@author tag), version(@version tag), and a short description (@desc tag) of the Example() testcase. Taggedparagraphs can extend over several lines as they end with the next tagged paragraph or withthe end of the documentation block. A list of tags that can be used in T3Doc comments isgiven in Table 2.1, along with information on their usage, taken from the T3Doc standard[8]. With the help of these tags, additional information about the TTCN-3 code can bespecified.

0 // ...

12 /*

3 * @author John Doe

4 * @version v0.1.4

5 * @desc This is an example of a testcase in ttcn -3

6 * this is line 2 of the description paragraph

7 */

89 testcase Example ( ) runs on Examplecomponent{

10 // TTCN -3 testcase code

11 }12 // ...

Listing 2.5: T3Doc Example: A Documentation Block

8

Page 13: Bachelorarbeit Documentation Generation for TTCN-3 filefor automatic documentation generation from TTCN-3 source code using a standardized ... Softwaredokumentation ist ein wichtiger

2 Foundations

Tag Specifies Occurrence (max., location)

@author Name(s) of the author(s) Any, preceding any element@config Test configuration Once, preceding testcases@desc Intention and functionality Any, preceding any element@exception Information on exception types Any, preceding signatures@member Name(s) of member(s) Any, preceding certain type-,

modulepar- and template definitions@param Parameters Any, preceding parameterized elements@purpose Test purposes Once, preceding testcases@remark Extra information Any, preceding any element@return Information on returned values Once, preceding signatures and functions@see Reference to other elements Any, preceding any element

or embedded in any T3Doc tag@since Module version when added Once, preceding any element@status Status Once, preceding any element@url Reference to external sources Any, preceding any element

or embedded in any T3Doc tag@verdict Circumstances of verdicts Any, preceding testcases,

functions, and altsteps@version Version Once, preceding any element

Table 2.1: The T3Doc Tags

9

Page 14: Bachelorarbeit Documentation Generation for TTCN-3 filefor automatic documentation generation from TTCN-3 source code using a standardized ... Softwaredokumentation ist ein wichtiger

2 Foundations

2.3 Extensible Markup Language (XML)

The Extensible Markup Language (XML) [2] is an open standard designed to store and carrysemistructured data and was recommended by the World Wide Web Consortium (W3C). Itis a markup language without predefined tags that derived from the Standard GeneralizedMarkup Language (SGML) [9]. The XML text representation stores data as plain text,making it hard- and software independent. This allows for easy exchange of data betweenheterogeneous systems. By predefining the tags, attributes, and structure (the schema) ofan XML document, new languages like XHTML [10], RSS [11], RDF [12], and OWL [13]can be created.

Listing 2.6 shows how data of a mailing address consisting of country, city, postal code,street, and street number could be stored in XML textual representation.

0 < ! -- [...] -->1 <address>2 <s t r e e t number=”7 ”>Goldschmidts t ras se</ s t r e e t>3 <c i t y z ip=”37077 ”>Goettingen</ c i t y>4 <country>Germany</ country>5 </ address>6 < ! -- [...] -->

Listing 2.6: XML Example: Address

A well-formed XML document consists of an XML declaration, one or more elements, andpossibly comments, processing instructions and white spaces. An XML declaration specifiesthe XML version that is used in the document. Elements are either empty — consistingof an empty-element tag and possibly attributes (for example <anemptyelement/>) — ornot empty — consisting of a start tag, a end tag, and possibly attributes and content. Anexample for a non-empty element would be <city zip="37077">Goettingen</city> asgiven in Listing 2.6, where zip="37077" is an attribute and the character string“Goettingen”is the content of the <city> element. Non-empty elements can also contain other elements.

An example of a well-formed XML document is given in Listing 2.7. The <contacts>element is called root element which contains all other elements of the XML document. Foran XML document to be not only well-formed but also valid, it needs an associated DocumentType Definition (DTD) [2], which is part of the XML standard, or an XML schema whichalso can be used for validation. Listing 2.8 shows a DTD defining the structure of a contactsXML document such as the one given in Listing 2.7.

10

Page 15: Bachelorarbeit Documentation Generation for TTCN-3 filefor automatic documentation generation from TTCN-3 source code using a standardized ... Softwaredokumentation ist ein wichtiger

2 Foundations

0 <?xml version=”1 .0 ” ?>1 <contac t s>2 <contact>3 <name>John Doe</name>4 <address>5 <s t r e e t number=”7 ”>Goldschmidts t ras se</ s t r e e t>6 <c i t y z ip=”37077 ”>Goettingen</ c i t y>7 <country>Germany</ country>8 </ address>9 </ contact>

10 <contact>11 <name>Jane Doe</name>12 <address>13 <s t r e e t number=”3 ”>Bunsenstrasse</ s t r e e t>14 <c i t y z ip=”37077 ”>Goettingen</ c i t y>15 <country>Germany</ country>16 </ address>17 </ contact>18 </ contac t s>

Listing 2.7: XML Example: Contacts

0 < !ELEMENT contac t s ( contact ∗)>1 < !ELEMENT contact (name , address )>2 < !ELEMENT name (#PCDATA)>3 < !ELEMENT address ( s t r e e t , c i ty , country )>4 < !ELEMENT s t r e e t (#PCDATA)>5 < !ATTLIST s t r e e t number CDATA #REQUIRED>6 < !ELEMENT c i t y (#PCDATA)>7 < !ATTLIST c i t y z ip CDATA #REQUIRED>8 < !ELEMENT country (#PCDATA)>

Listing 2.8: DTD Example: Contacts

An XML element is declared via an Element type declaration, which defines its name andcontent as <!ELEMENT name (content)>. The content is either a sequence of other elements(including #PCDATA for text), EMPTY for no content, or ANY for any content. In this sequence,elements can either be in an ordered list (element1, element2, element1) or in a list ofalternatives where only one element is chosen from (element1 | element2 | element3).A sequence can be treated as an element by using brackets — for example, element1,(element2 | element3), element4. By adding quantifiers like in regular expressions be-hind elements, the number of occurrences can be specified. In Line 0, the <contacts>element is defined as a sequence of any number of <contact> elements, which are definedin Line 1 as consisting of exactly one <name>- and one <address> element. The attributesof elements are defined with <!ATTLIST elementname list_of_attributes> where an at-tribute consists of a name, a type and a default value as shown in Lines 5 and 7.

11

Page 16: Bachelorarbeit Documentation Generation for TTCN-3 filefor automatic documentation generation from TTCN-3 source code using a standardized ... Softwaredokumentation ist ein wichtiger

2 Foundations

2.3.1 XML Schema Definition

The XML Schema Definition (XSD) [3] is an XML schema language recommended by theW3C. It is also known as XML Schema. Like a DTD, an XML schema defines the structureof an XML document, but has several advantages. For example, it supports data types,which makes it possible to check if the data is correct. XML Schema comes with severalprimitive datatypes (e.g., integer or boolean), with which new data types can be createdby using restrictions, lists, and unions of them. Also, XML schemas themselves are writtenin XML, therefore they have all the advantages of XML text representations.

0 <xs:schema xmlns :xs=”ht tp : //www.w3 . org /2001/XMLSchema”>1 <xs : e l ement name=”address ”>2 <xs:complexType>3 <xs : s equence>4 <xs : e l ement r e f=” s t r e e t ” />5 <xs : e l ement r e f=”c i t y ” />6 <xs : e l ement name=”country ” type=”x s : s t r i n g ” />7 </ xs : s equence>8 </xs:complexType>9 </ xs : e l ement>

10 <xs : e l ement name=”c i t y ”>11 <xs:complexType mixed=”true ”>12 <x s : a t t r i b u t e name=”z ip ” type=”x s : s t r i n g ” use=”requ i r ed ” />13 </xs:complexType>14 </ xs : e l ement>15 <xs : e l ement name=”contact ”>16 <xs:complexType>17 <xs : s equence>18 <xs : e l ement name=”name” type=”x s : s t r i n g ” />19 <xs : e l ement r e f=”address ” />20 </ xs : s equence>21 </xs:complexType>22 </ xs : e l ement>23 <xs : e l ement name=”contac t s ”>24 <xs:complexType>25 <xs : s equence>26 <xs : e l ement r e f=”contact ” minOccurs=”0 ” maxOccurs=”unbounded ” />27 </ xs : s equence>28 </xs:complexType>29 </ xs : e l ement>30 <xs : e l ement name=” s t r e e t ”>31 <xs:complexType mixed=”true ”>32 <x s : a t t r i b u t e name=”number ” type=”x s : s t r i n g ” use=”requ i r ed ” />33 </xs:complexType>34 </ xs : e l ement>35 </xs:schema>

Listing 2.9: XSD Example: Contacts

12

Page 17: Bachelorarbeit Documentation Generation for TTCN-3 filefor automatic documentation generation from TTCN-3 source code using a standardized ... Softwaredokumentation ist ein wichtiger

2 Foundations

Listing 2.9 shows an XML Schema equivalent of the DTD in Listing 2.8. Elements thatcan contain other elements or have attributes are defined as complex types such as the<address> element or the <city> element. The <address> element is defined in Lines2-10, consisting of a sequence of three other elements (<street>, <city>, and <country>).In Line 14 the zip attribute of the <city> element is defined as a character string — aprimitive data type of XML Schema.

2.3.2 Extensible Stylesheet Language Transformations (XSLT)

Extensible Stylesheet Language Transformations (XSLT) [4, 5] is a language recommendedby the W3C in 1999. It is used to transform a source XML document into a result XMLdocument — for example, into an XHTML document, to display the data in a web browser —or a different text-based format. The source document is not altered. During transformation,patterns are matched against elements of the source document and templates are used tocreate the result document with those elements.

By using XSLT, the data is separated from its presentation. This has several advantages,for example, multiple output formats: using the same source document, several presentationsof the same data can be produced by using different XSL [5] stylesheets. On the other hand,the same stylesheet can be used for different source documents of the same structure.

0 <xsl :stylesheet version=”2 .0 ” <!-- [...] --> >1 <xsl:output method=”xml ” <!-- [...] --> />2 <xsl:template match=”/ ”>3 <html>4 <head> < t i t l e>Contacts</ t i t l e> </head>5 <body>6 <t ab l e border=”1 ”>7 <t r>8 <th>Name</ th>9 <th>Country</ th>

10 </ t r>11 <xsl:apply−templates s e l e c t=”// contact ”/>12 </ tab l e>13 </body>14 </html>15 </xsl:template>16 <xsl:template match=”contact ”>17 <t r>18 <td><xsl:value−of s e l e c t=”name/ text ( ) ”/></ td>19 <td><xsl:value−of s e l e c t=”address / country / text ( ) ”/></ td>20 </ t r>21 </xsl:template>22 </xsl :stylesheet>

Listing 2.10: XSLT Example: Address

13

Page 18: Bachelorarbeit Documentation Generation for TTCN-3 filefor automatic documentation generation from TTCN-3 source code using a standardized ... Softwaredokumentation ist ein wichtiger

2 Foundations

To illustrate how XSLT works, an example of an XSL stylesheet is given in Listing 2.10.Used on the example in Listing 2.7, it would produce the HTML [14] document shownin Listing 2.11. First, a template matching the root element (Lines 2-15) is called. Theelements are matched via XPath [15], which is a navigation language for XML. The contentsof a called template define the output written to the result document. In Line 11, anothertemplate that matches all <contact> elements of the source document is called. It is calledseparately for each of those elements. This template is defined in Lines 16-21 and creates a<tr> element containing two <td> elements each time it is called. The first <td> elementcontains the contents of the <name> element inside the <contact> element the templatewas called with. The second contains the contents of the <country> element inside the<address> element. This results in an HTML table with the names and country of acontact.

0 <html>1 <head>2 <t i t l e>Contacts</ t i t l e>3 </head>4 <body>5 <table border=”1 ”>6 <tr>7 <th>Name</th>8 <th>Country</th>9 </ tr>

10 <tr>11 <td>John Doe</td>12 <td>Germany</td>13 </ tr>14 <tr>15 <td>Jane Doe</td>16 <td>Germany</td>17 </ tr>18 </table>19 </body>20 </html>

Listing 2.11: Result Document

Templates can also be named by giving them a name attribute and can be called withparameters using the <with-param> element. XSLT also has control flow operators like ifconstructs (<xsl:if>) or iterators (<xsl:for-each>).

14

Page 19: Bachelorarbeit Documentation Generation for TTCN-3 filefor automatic documentation generation from TTCN-3 source code using a standardized ... Softwaredokumentation ist ein wichtiger

2 Foundations

2.3.3 Extensible Stylesheet Language Formatting Objects (XSL-FO)

The Extensible Stylesheet Language Formatting Objects (XSL-FO) [5] is a language recom-mended by the W3C for describing the formatting of XML data. XSL-FO documents areXML documents following a schema that contains information regarding the layout of theirdata. This information (also XML data) can be used by XSL-FO processors to generatereadable/printable output formats such as the Portable Document Format (PDF) [16].

The root of an XSL-FO document is the <fo:root> element. Inside the root element thereis one <fo:layout-master-set> element and at least one <fo:page-sequence> element(or <fo:page-sequence-wrapper>). The <fo:layout-master-set> element holds a list oftemplates defining the size and shape of pages, while the <fo:page-sequence> elementscontain the actual content of those pages.

To illustrate the structure of an XSL-FO document, an example is given in Listing 2.12.In Lines 7-15, a template with the unique name “A4” is shown. That name can be used forreferencing. It defines the page size and margins via attributes. Inside, the regions of thepage are defined. The footer and header of the page are represented by region-before andregion-after, while region-start and region-end are sidebars. They are all part of theregion-body — which is where the output is written to.

0 <?xml version=”1 .0 ” encoding=”UTF−8”?>1 < f o : r o o t xmlns : f o=”ht tp : //www.w3 . org /1999/XSL/Format ”>23 <f o : l a you t−master−s e t>4 <f o : s imp l e−page−master master−name=”A5”>5 < ! -- content -->6 </ f o : s imp l e−page−master>7 <f o : s imp l e−page−master master−name=”A4” page−width=”210mm”8 page−he ight=”297mm” margin−top=”1cm” margin−bottom=”1cm”9 margin− l e f t=”1cm” margin−r i g h t=”1cm”>

10 <f o : r e g i o n−body margin=”3cm”/>11 <f o : r e g i o n−be f o r e extent=”2cm”/>12 <f o : r e g i o n−a f t e r extent=”2cm”/>13 <f o : r e g i o n−s t a r t extent=”2cm”/>14 <f o : r e g i o n−end extent=”2cm”/>15 </ f o : s imp l e−page−master>16 </ f o : l a you t−master−s e t>1718 <f o :page−sequence master−r e f e r e n c e=”A4”>19 < f o : f l ow flow−name=”xs l−reg ion−be f o r e ”>20 < f o : b l o c k background−c o l o r=”red ”>This i s a block .</ f o : b l o c k>21 </ f o : f l ow>22 </ fo :page−sequence>23 </ f o : r o o t>

Listing 2.12: XSL-FO Example

15

Page 20: Bachelorarbeit Documentation Generation for TTCN-3 filefor automatic documentation generation from TTCN-3 source code using a standardized ... Softwaredokumentation ist ein wichtiger

2 Foundations

An <fo:page-sequence> element (as defined in Lines 18-22) defines output pages. Theyrefer to a page template — in this case, <fo:simple-page-master master-name="A4"> —and hold a <fo:flow> element that contains the actual content of the page. The flow-nameattribute decides to what part of the body region the output is written to — in this case,to the header. The output in this example is a red block (Line 20) with “This is a block.”written on it. An XSL-FO processor would process this document into a single A4 pagewith a red header saying “This is a block.”

Since XSL-FO documents are XML documents, XSLT can be used to create them froma source XML file. This makes it possible to use an XSLT document to create the sameXSL-FO output for many XML files of the same structure.

16

Page 21: Bachelorarbeit Documentation Generation for TTCN-3 filefor automatic documentation generation from TTCN-3 source code using a standardized ... Softwaredokumentation ist ein wichtiger

3 Documentation Transformations

In this chapter, the documentation transformations are explained. In the first section, theoutput requirements for the HTML and PDF formats are described. In the second section,the approach of these transformations is described. The following section is about the XMLSchema that is used to store information about TTCN-3 modules. It defines the structureof the source XML documents that are used in the creation of the documentation and willbe called T3DocML in the remainder of this thesis. The last two sections of this chapterdescribe the transformations of T3DocML to HTML and XSL-FO with XSL stylesheets.

3.1 Requirements

The aim is to create a technical documentation in HTML and PDF formats, which containsall information available in the TTCN-3 modules of a project in an easily accessible andclearly arranged format. It shall feature information processed from T3Doc documentationblocks.

3.1.1 HTML Output Requirements

The HTML documentation should have

• A navigation menu,

• Information from the documentation blocks,

• Information on the elements (source code),

• Cross-references to other elements.

The HTML pages shall be divided into two parts: the navigation menu and the content.The navigation menu shall also have two parts. As seen in Figure 3.1, one part of the menushall be a list of hyperlinks to all HTML files documenting the modules of the TTCN-3project. The Modules hyperlink shall refer to the index page. The other part shall be alist of all element types, including groups. When clicked on, a list of all elements of thattype should appear (for example, via Javascript [17]). These two menus should appear onevery page of the HTML documentation to allow for easy navigation. The contents of theHTML pages shall contain the information extracted from the documentation blocks in the

17

Page 22: Bachelorarbeit Documentation Generation for TTCN-3 filefor automatic documentation generation from TTCN-3 source code using a standardized ... Softwaredokumentation ist ein wichtiger

3 Documentation Transformations

source code and the source code of the elements itself. This source code should containcross-references (hyperlinks) to documentation pages of other TTCN-3 elements referencedin it. This way, the documentation of all elements involved can be accessed quickly. Also,words marked with embedded @see tags shall be cross-references, if a corresponding elementis found within the documentation.

Figure 3.1: A Screenshot of the HTML Documentation

18

Page 23: Bachelorarbeit Documentation Generation for TTCN-3 filefor automatic documentation generation from TTCN-3 source code using a standardized ... Softwaredokumentation ist ein wichtiger

3 Documentation Transformations

3.1.2 PDF Output Requirements

Every module shall have its own block in the PDF document. Illustrated in Figure 3.2 isthe block that the module shown in Listing 3.1 should generate. Every element, includinggroups, shall have its own block inside the module blocks, with its signature1 as a headline.The source code of the elements should not be displayed to make the documentation morecompact. Information from the T3Doc paragraphs shall be displayed in a way similar tothe HTML documentation.

Figure 3.2: A Screenshot of the PDF Documentation

1Element signatures are not to be confused with TTCN-3 signatures

19

Page 24: Bachelorarbeit Documentation Generation for TTCN-3 filefor automatic documentation generation from TTCN-3 source code using a standardized ... Softwaredokumentation ist ein wichtiger

3 Documentation Transformations

3.2 Approach

The goal is to create documentation for TTCN-3 projects in HTML and PDF formats.To achieve this, the necessary data from the TTCN-3 code needed for the documentationwill be used to create an XML document in the T3DocML schema. After that, XSLT willbe used to transform T3DocML into HTML and an XSL-FO that is used to create thedocumentation in PDF format. This approach is shown in Figure 3.3.

Figure 3.3: Approach

3.3 The T3DocML Schema

First, we need to find an appropriate XML representation of the TTCN-3 source code. Itmust contain all data that is needed to create the documentation. We call the XML Schemaused in this thesis T3Doc Markup Language (T3DocML). As shown in Listing 7.1 andFigure 3.4 in a graphical representation, the structure of T3DocML is abstracted from thestructure of TTCN-3, limited to modules, element definitions, and information from T3Docdocumentation blocks.

For the HTML documentation, the name, location of the associated HTML file, T3Doccomments, and source code of all TTCN-3 elements are needed. The PDF documentationwill need the name, T3Doc comments, and the signatures of these elements. The XML doc-ument must also contain information on where the TTCN-3 elements are located inside theTTCN-3 project that is to be documented. Listing 3.1 shows a TTCN-3 module containinga group with a testcase, and a function. It also contains two T3Doc documentation blocksbelonging to the module and the testcase. Listing 3.2 shows where the TTCN-3 elements ofListing 3.1 will be located inside the XML code. They are stored inside the module elementassociated with the TTCN-3 module to which they belong. The original group structure ismaintained.

20

Page 25: Bachelorarbeit Documentation Generation for TTCN-3 filefor automatic documentation generation from TTCN-3 source code using a standardized ... Softwaredokumentation ist ein wichtiger

3 Documentation Transformations

Figure 3.4: Graphical Representation of the T3DocML Schema

21

Page 26: Bachelorarbeit Documentation Generation for TTCN-3 filefor automatic documentation generation from TTCN-3 source code using a standardized ... Softwaredokumentation ist ein wichtiger

3 Documentation Transformations

0 /*

1 * @author John Doe

2 * @desc This is an example of a module in ttcn -3

3 */

4 module Examplemodule {5 group ExampleGroup {6 /*

7 * @author John Doe

8 * @version v0.1.4

9 * @remark an embedded tag is used here , @see ExampleFunction

10 */

11 testcase ExampleTestcase ( ) runs on Examplecomponent{12 // TTCN -3 testcase code

13 }14 }15 function ExampleFunction ( in charstring par1 , out charstring par2 )16 return boolean {17 // TTCN -3 function code

18 }19 }

Listing 3.1: TTCN-3: ExampleModule

0 <p r o j e c t>1 < !−− [ . . . ] −−>2 <module>3 <name>Examplemodule</name>4 <comment> < !−− con ten t s −−> </comment>5 <group>6 <name>Examplegroup</name>7 <element type=” t e s t c a s e ”> < !−− con ten t s −−> </ element>8 </group>9 <element type=”func t i on ”> < !−− con ten t s −−> </ element>

10 <module>11 </ p r o j e c t>

Listing 3.2: T3DocML: ExampleModule

The information from the T3Doc comments of TTCN-3 elements, groups, and mod-ules is stored inside the <comment> element, where every T3Doc tag has its own ele-ment. For example, the comment @author John Doe would be stored as <author>JohnDoe</author>. Listing 3.3 shows the T3DocML representation of the documentation blockpreceding ExampleTestcase() in Listing 3.1. To mark references to other TTCN-3 elements(identified by embedded @see tags), <esee> elements are used as shown in Line 4.

22

Page 27: Bachelorarbeit Documentation Generation for TTCN-3 filefor automatic documentation generation from TTCN-3 source code using a standardized ... Softwaredokumentation ist ein wichtiger

3 Documentation Transformations

0 <comment>1 <author>John Doe</author>2 <vers ion>v .0 .1 .4 </ vers ion>3 <remark>4 an embedded tag i s used here , @see <esee>ExampleFunction</esee>5 </remark>6 <comment>

Listing 3.3: T3DocML: Comments

The source code is contained inside <behaviour> elements, where <newline/> elementsmark the beginning of a new line and references will be marked (similar to embedded@see tags) with <link> elements, which contain the location of the referenced elementsas attribute (<link loc="...">...</link>). The root of the T3DocML document is the<project> element. It contains every <module> and a list of all the HTML files that arecreated, to verify references to other elements inside the TTCN-3 source code.

3.4 Transforming T3DocML to HTML

Using XSLT, a transformation from T3DocML to HTML can be described. This sectiondescribes the generation of the documentation in HTML format.

3.4.1 Navigation

To navigate between the different element- and module documentation files, a navigationmenu is created. The part of the navigation, that contains a list of all modules, is generatedby calling the template shown in Listing 3.4.

0 <x s l : t emp l a t e name=”index modu l e l i s t ”>1 <p c l a s s=” index head l i n e ”><a h r e f=” . . . ”>Modules</a></p>2 <ul>3 <x s l : f o r −each s e l e c t=”//module ”>4 < l i>5 <a h r e f=”{name/ text ( ) } . html ”><xs l : copy−o f s e l e c t=”name/ text ( ) ”/></a>6 </ l i>7 </ x s l : f o r −each>8 </ u l>9 </ x s l : t emp l a t e>

Listing 3.4: XSLT: Module Navigation

The lists of the elements are generated by selecting all elements of a certain type andcalling the index_elementlist template with those elements as parameters, as shown inListing 3.5.

23

Page 28: Bachelorarbeit Documentation Generation for TTCN-3 filefor automatic documentation generation from TTCN-3 source code using a standardized ... Softwaredokumentation ist ein wichtiger

3 Documentation Transformations

0 <x s l : c a l l −template name=” i nd ex e l emen t l i s t ”>1 <xs l :w i th−param name=”th i s ” s e l e c t=”$ t h i s // element [ @type eq ’ funct ion ’ ] ”/>2 </ x s l : c a l l −template>

Listing 3.5: XSLT: Calling index elementlist

The index_group template in Listing 3.6 generates a list of groups. This list can containother lists as shown in Figure 3.5. This is done by recursion. In Lines 6-8, the templatecalls itself with all <group> elements of its current element as parameters and creates anunordered list with them.

0 <x s l : t emp l a t e name=”index group ”>1 <xs l :param name=”th i s ”/>2 <x s l : f o r −each s e l e c t=”$ t h i s ”>3 < l i><a h r e f=”{ l o c a t i o n / text ( )} ”><xs l : copy−o f s e l e c t=”name/ text ( ) ”/></a>4 < x s l : i f t e s t=” . / group ”>5 <ul>6 <x s l : c a l l −template name=”index group ”>7 <xs l :w i th−param name=”th i s ” s e l e c t=” . / group ”/>8 </ x s l : c a l l −template>9 </ u l>

10 </ x s l : i f>11 </ l i>12 </ x s l : f o r −each>13 </ x s l : t emp l a t e>

Listing 3.6: XSLT: Group Navigation

Figure 3.5: Group Structure of the HTML Navigation

24

Page 29: Bachelorarbeit Documentation Generation for TTCN-3 filefor automatic documentation generation from TTCN-3 source code using a standardized ... Softwaredokumentation ist ein wichtiger

3 Documentation Transformations

3.4.2 Source Code and Comments

The source code of the TTCN-3 elements is transformed into a <p> element and <newline/>tags are replaced by <br/> tags to mark the end of a line. Similarly, the tagged T3Docparagraphs are transformed to list-items (<li>) where every tag gets its own list.

3.4.3 References

The references in the source code, which are marked with <link> elements inside a<behaviour> element, are turned into cross-references by calling the link template withthem. This template searches all <file> elements of the root element for one that matchesthe loc attribute of the <link> elements. If one is found, a hyperlink referring to theelement is generated.

0 <x s l : t emp l a t e match=”see ”>1 <x s l : v a r i a b l e name=”text ” s e l e c t=”normal ize−space ( t ext ( ) ) ” />2 <x s l : c h o o s e>3 <xs l :when t e s t=”conta in s ($ text , ’ . ’ ) ”>4 <x s l : v a r i a b l e name=” f i l e ” s e l e c t=”/ p r o j e c t / f i l e [ conta in s ( t ext ( ) ,5 concat ( ’ e ’ , subs t r ing−a f t e r ($ text , ’ . ’ ) , ’ . html ’ ) ) and6 conta in s ( t ext ( ) , concat ( ’ m ’ , subs t r ing−be f o r e ($ text , ’ . ’ ) , ’ o ’ ) ) ] ”/>7 < x s l : i f t e s t=”$ f i l e ”>8 < l i c l a s s=”comment l i s t i tem ”>9 <a h r e f=”{$ f i l e / t ext ( )} ”><xs l : copy−o f s e l e c t=”$ text ”/></a>

10 </ l i>11 </ x s l : i f>12 < x s l : i f t e s t=”not ($ f i l e ) ”>13 < l i c l a s s=”comment l i s t i tem ”><xs l : copy−o f s e l e c t=”text ( ) ”/></ l i>14 </ x s l : i f>15 </ xs l :when>16 <x s l : o t h e rw i s e>17 <x s l : v a r i a b l e name=” f i l e ” s e l e c t=”/ p r o j e c t / f i l e [ conta in s ( t ext ( ) ,18 concat ( ’ e ’ , $ text , ’ . html ’ ) ) ] ”/>19 < x s l : i f t e s t=”$ f i l e ”>20 < l i c l a s s=”comment l i s t i tem ”>21 <a h r e f=”{$ f i l e / t ext ( )} ”><xs l : copy−o f s e l e c t=”$ text ”/></a>22 </ l i>23 </ x s l : i f>24 < x s l : i f t e s t=”not ($ f i l e ) ”>25 < l i c l a s s=”comment l i s t i tem ”><xs l : copy−o f s e l e c t=”text ( ) ”/></ l i>26 </ x s l : i f>27 </ x s l : o t h e rw i s e>28 </ x s l : c h o o s e>29 </ x s l : t emp l a t e>

Listing 3.7: XSLT: The see Template

25

Page 30: Bachelorarbeit Documentation Generation for TTCN-3 filefor automatic documentation generation from TTCN-3 source code using a standardized ... Softwaredokumentation ist ein wichtiger

3 Documentation Transformations

References using the @see tag inside the comments are handled by the see templateshown in Listing 3.7. These references can either be just the name of an element orthe name of a module and the name of an element separated by a dot (for example,@see ExampleModule.ExampleTestcase, which refers to the ExampleTestcase inside theExampleModule). Similar to references in the source code, <file> elements are searched forone that contains these names, to ensure that only existing documentation pages are cross-referenced. When there is a dot between module an element name, Lines 4-6 are executed,where the template searches for an HTML file name that belongs to a module that matchesthe character string before the dot and represents an element that matches the characterstring after the dot. If there is one, it is stored inside a XSL variable called file. Whenthere is no dot, the template tries to match only the element part (Lines 17-18). After that,if the file variable is not empty, a hyperlink referring to the first file inside this variableis generated (Lines 7-11 and 19-23). If it is empty, the text inside the <see> tags will beprinted normally (Lines 12-14 and 24-26). The same is done for embedded @see tags.

3.5 Transforming T3DocML to XSL-FO

Similar to the previous section, this section describes a transformation from T3DocML toXSL-FO using XSLT. First, the template matching the <module> elements is called for everymodule in the project. This template creates an <fo:block> containing two other blocks:one for the T3Doc comments about the module and another for the elements and groupscontained within the module. The same is done for groups, so every group is within theblock belonging to its parent group. The contents of modules and groups are transformedusing the modulecontent template shown in Listing 3.8. This listing shows only the partof the template that deals with functions.

0 <x s l : t emp l a t e name=”modulecontent ”>1 <xs l :param name=”th i s ”/>2 < x s l : i f t e s t=”count ($ t h i s / element [ @type eq ’ funct ion ’ ] ) &gt ; 0 ”>3 < f o : b l o c k border=”3pt s o l i d black ” border−bottom−s t y l e=”hidden ”4 border−l e f t−s t y l e=”hidden ” border−r i ght−s t y l e=”hidden ” margin−top=”7pt ”>5 < f o : b l o c k text−a l i g n=” l e f t ” font−weight=”bold ” font−s i z e=”10pt ”6 margin−top=”10pt ”>7 < f o : i n l i n e>Functions</ f o : i n l i n e>8 </ f o : b l o c k>9 <xs l : app ly−templates s e l e c t=”$ t h i s / element [ @type eq ’ funct ion ’ ] ”/>

10 </ f o : b l o c k>11 </ x s l : i f>12 < !−− . . . −−>13 </ x s l : t emp l a t e>

Listing 3.8: XSLT: The modulecontent Template

26

Page 31: Bachelorarbeit Documentation Generation for TTCN-3 filefor automatic documentation generation from TTCN-3 source code using a standardized ... Softwaredokumentation ist ein wichtiger

3 Documentation Transformations

For every type of element, the template tests whether or not elements of this type existwithin the module/group (Line 2). If there are elements of a certain type, this templatewill create a headline with the name of the type (Line 7) and call the corresponding tem-plates with those elements (Line 9). The template matching elements will simply createan <fo:block> for an element, containing its signature as headline and underneath that,information from the documentation blocks.

27

Page 32: Bachelorarbeit Documentation Generation for TTCN-3 filefor automatic documentation generation from TTCN-3 source code using a standardized ... Softwaredokumentation ist ein wichtiger

4 Implementation

This chapter deals with the implementation of the approach described in Chapter 3. Thefirst step is to get the necessary data from the TTCN-3 files. This is done via Java withthe help of TRex [18] — an Eclipse plug-in and analysis infrastructure for TTCN-3. In thesecond step this data will be evaluated and stored in T3DocML as described in Section 3.3.The XSL Transformations are done by the open source Saxon XSLT processor [19]. Theresulting XSL-FO document is then processed by Apache FOP [20] — an XSL-FO processorby Apache — into a PDF file. This procedure is depicted in Figure 4.1.

Figure 4.1: Implementation

4.1 Building T3DocML from TTCN-3

The TTCN-3 code is scanned and parsed by TRex. TRex creates an Abstract SyntaxTree (AST) of the code. This tree is then traversed by depth-first search using a visitor[21] that calls methods when visiting nodes of the tree. Whenever nodes representing newTTCN-3 elements are encountered, the visitor builds instances of the TTCN3Element classrepresenting the elements with information on the elements extracted from the AST andthe source code comments provided by TRex. The TTCN3Element instances are send tothe XMLBuilder (see Section 4.1.3) component which handles new elements, groups, andmodules. An example of an AST is given in Figure 4.2. It shows the module given in Listing3.1 in the AST view of TRex.

28

Page 33: Bachelorarbeit Documentation Generation for TTCN-3 filefor automatic documentation generation from TTCN-3 source code using a standardized ... Softwaredokumentation ist ein wichtiger

4 Implementation

Figure 4.2: TRex AST View: ExampleModule

4.1.1 The Classes Representing TTCN-3 Code

The Java classes representing TTCN-3 code are

• TTCN3Project

• TTCN3Module

• moduleElements

• TTCN3Element

• TTCN3El

• TTCN3Group

• TTCN3Comment

29

Page 34: Bachelorarbeit Documentation Generation for TTCN-3 filefor automatic documentation generation from TTCN-3 source code using a standardized ... Softwaredokumentation ist ein wichtiger

4 Implementation

A TTCN3Project consists of two arrays: one for TTCN3Modules and one for Strings rep-resenting the filenames of all HTML files that will be created by the Saxon XSLT processor.

A TTCN3Module consists of one moduleElements-, one TTCN3Comment-, and one Stringvariable representing the name of the module. A modulelements instance contains a Vectorof TTCN3Elements.TTCN3Element is an abstract class representing the elements a module can contain, in-

cluding groups. It has five fields:

• name — the name of the element

• location — the name of the HTML file documenting the element

• behavior — the source code of the element, including references

• sign — the signature of the element, without references

• comment — information from the T3Doc documentation blocks

The TTCN3El class extends the TTCN3Element class. It represents all TTCN-3 elements,except groups. It has a type attribute and a toString() method (shown in Listing 4.1)that returns the T3DocML representation of the element.

0 public St r ing toS t r i ng ( ){1 return2 ”<element type=\”” + type + ”\”>\n” +3 ”<name>” + name + ”</name>\n” +4 ”<l o ca t i on >” + l o c a t i o n + ”</l o ca t i on >\n” +5 comment . t oS t r i ng ( ) +6 ”<behaviour>” + behaviour + ”</behaviour>” +7 ”<s ign>” + s ign + ”</s ign>” +8 ”</element>\n” ;9 }

Listing 4.1: The toString() Method

TTCN3Group also extends the TTCN3Element class. It represents only groups. It contains allelements inside a group (even other groups) in a moduleElements instance. A TTCN3Groupalso has a variable representing the location of the group in the TTCN-3 code, so thedocumentation tool knows which elements belong to it.

The TTCN3Comment class contains information about the T3Doc comments of an element.It is instantiated with a variable containing a T3Doc documentation block as an argumentand returns the T3DocML representation of this block via toString() method.

30

Page 35: Bachelorarbeit Documentation Generation for TTCN-3 filefor automatic documentation generation from TTCN-3 source code using a standardized ... Softwaredokumentation ist ein wichtiger

4 Implementation

4.1.2 Visitor

As stated earlier, the visitor will execute certain methods upon encountering certain nodesin the tree that represents the TTCN-3 source code during a depth-first traversal. Forexample, if it visits a TestcaseDef node, it executes the VisitTestcaseDef() method.When it encounters the definition of a new Module (TTCN3Module node), it passes on theinformation to the XMLBuilder. Upon visiting other element definitions, the visitor willread and process the necessary data of this element from the syntax tree and use it to createan instance of TTCN3El that represents the element. The TTCN3El is then transfered to theXMLBuilder. The same is done for TTCN3Groups.

Getting the Data From the AST

First, the name of every element is required. To get it, the identifier node of the elementdefinition needs to be found. The visitor traverses the AST until it finds this node andreturns it. After that, the behavior of the element needs to be read and processed. Listing4.2 shows the getBehaviour() method.

0 private St r ing getBehaviour ( LocationAST node ){1 St r ing elName = getName ( node ) ;2 S t r ing e lLoca t i on = getLocat ion ( node ) ;3 Vector<TTCN3Reference> r e f v e c t o r = ge tRe f e r ence s ( node ) ;4 S t r ing b = getWholeElement ( node ) ;5 b = St r ingEscapeUt i l s . escapeXml (b ) . r e p l a c eA l l ( ”\n” , ” <newl ine/> ” ) ;6 for (TTCN3Reference r : r e f v e c t o r ){7 b = b . r e p l a c eA l l ( ”( | \\ t ) ” + r . name + ” ” , ” < l i n k l o c =\”” +8 r . l o c a t i o n + ”\”>” + r . name + ”</l ink > ” ) ;9 b = b . r e p l a c eA l l ( ”( | \\ t ) ” + r . name + ” ; ” , ” < l i n k l o c =\”” +

10 r . l o c a t i o n + ”\”>” + r . name + ”</l ink >; ” ) ;11 b = b . r e p l a c eA l l ( ”( | \\ t ) ” + r . name + ” , ” , ” < l i n k l o c =\”” +12 r . l o c a t i o n + ”\”>” + r . name + ”</l ink >, ” ) ;13 }14 b = b . r e p l a c eA l l ( ” ” + elName + ” ” , ” < l i n k l o c =\”” +15 e lLoca t i on + ”\”>” + elName + ”</l ink > ” ) ;16 return b ;17 }

Listing 4.2: The getBehaviour() Method

It is called with the element definition node as argument and returns the behavior of anelement with references marked by <link> tags, so they can be identified later on. The laststep is to extract the documentation blocks from the TTCN-3 source code. This is realizedby using the getCommentsBefore() method provided by TRex.

31

Page 36: Bachelorarbeit Documentation Generation for TTCN-3 filefor automatic documentation generation from TTCN-3 source code using a standardized ... Softwaredokumentation ist ein wichtiger

4 Implementation

4.1.3 XMLBuilder

The XMLBuilder class holds all TTCN3Modules, TTCN3Groups, and TTCN3Els. It assigns theelements to the respective modules and groups and returns the T3DocML representation ofthe whole TTCN-3 project.

Adding Groups

Groups are added via newGroup() method by the visitor. This method is shown in Listing4.3. It holds an array of TTCN3Groups which is used to maintain the original group structure.When all elements of a group are already parsed, the group is added to its parent group ordirectly to the current module.

0 public void newGroup(TTCN3Group group ){1 p r o j e c t . addFi le ( group . getLocat ion ( ) ) ;2 while ( ! groups . isEmpty ( ) &&3 group . g e tO f f s e t ( ) > groups . lastElement ( ) . g e tO f f s e t ( ) ){4 TTCN3Group tempGroup ;5 tempGroup = groups . lastElement ( ) ;6 groups . remove ( groups . lastElement ( ) ) ;7 i f ( ! groups . isEmpty ( ) )8 groups . lastElement ( ) . add ( tempGroup ) ;9 else

10 currentModule . add ( tempGroup ) ;11 }12 groups . add ( group ) ;13 }

Listing 4.3: The newGroup() Method of the XMLBuilder

Adding Elements

Adding elements is similar to adding groups. Every element will either be added to itsassociated group or the current module.

Creating the T3DocML File

After all modules are added to the project, the T3DocML textual representation is returnedby using the buildXML() method of the project. It returns the root element (<project>)as a String.

32

Page 37: Bachelorarbeit Documentation Generation for TTCN-3 filefor automatic documentation generation from TTCN-3 source code using a standardized ... Softwaredokumentation ist ein wichtiger

4 Implementation

4.1.4 Processing the Comments

When an instance of TTCN3Comment is created, it is given the comments from the TTCN-3source code and a variable representing an element type. The tagged paragraphs from thecomments are matched via regular expressions and stored in arrays. Each T3Doc tag hasits own array. The @remark paragraph from Listing 3.1 Line 9 would be stored in an arraycalled remark as "an embedded tag is used here, @see ExampleFunction".

Marking the References

To place the <esee> tags around the references identified by embedded @see tags, thereplaceSee() method is called with elements from the T3Doc tag arrays as argument.This method is shown in Listing 4.4.

0 private St r ing r ep l a c eSee ( S t r ing c ){1 int pos ;2 c = c . r ep l a c e ( ” @see ” , ” @SEE ”) + ’ ’ ;3 while ( c . conta in s ( ” @SEE ”)){4 pos = c . indexOf ( ” @SEE ” ) ;5 i f ( pos != −1){6 St r ing i d e n t i f i e r = ”” ;7 for ( int i = pos+6; i < c . l ength ( ) && c . charAt ( i ) != ’ ’ ; i++){8 i d e n t i f i e r += c . charAt ( i ) ;9 }

10 i f ( i d e n t i f i e r . conta in s ( ”@see ”) )11 break ;12 i d e n t i f i e r = i d e n t i f i e r . r ep l a c e ( ”@SEE” , ”” ) . r ep l a c e ( ” ” , ”” ) ;13 c = c . r ep l a c e ( ”@SEE ” + i d e n t i f i e r + ” ” , ”@see <esee>”14 + i d e n t i f i e r + ”</esee>” ) ;15 } else16 break ;17 }18 return c . r ep l a c e ( ”@SEE” , ”@see ” ) ;19 }

Listing 4.4: The replaceSee() Method

First, it replaces every “@see” with “@SEE” to mark references that have not been replacedyet. It then searches for every“@SEE”in the input string. Upon finding one, the identifierbehind the @SEE tag is determined (Lines 7-9) and then marked with <esee> tags (Lines13-14). After that, “@SEE” is changed back to “@see”. When every “@SEE” is replaced, allreferences are marked and the paragraph is returned.

33

Page 38: Bachelorarbeit Documentation Generation for TTCN-3 filefor automatic documentation generation from TTCN-3 source code using a standardized ... Softwaredokumentation ist ein wichtiger

4 Implementation

4.2 Transforming T3DocML to HTML

The actual transformation from T3DocML to HTML is done by a method calledxmltohtml() of the DocTransform class. This method is shown in Listing 4.5. It implementsthe transformation described in Section 3.4. It uses an instance of the Transformerfactoryclass of Saxon to perform the transformation. The complete XSL stylesheet used for thistransformation can be found in Listing 7.2.

0 public stat ic void xmltohtml ( S t r ing foldername , S t r ing xmlFileName ){1 System . setProperty ( ”javax . xml . trans form . TransformerFactory ” ,2 ”net . s f . saxon . TransformerFactoryImpl ” ) ;3 TransformerFactory t f a c t o r y = TransformerFactory . newInstance ( ) ;4 Transformer t rans fo rmer ;5 try {6 trans fo rmer = t f a c t o r y . newTransformer (new StreamSource7 (new F i l e ( x s l S t y l e s h e e t ) ) ) ;8 t rans fo rmer . setParameter ( ” f o l d e r ” , fo ldername ) ;9 t rans fo rmer . trans form (new StreamSource

10 (new F i l e ( xmlFi le ) ) ,11 new StreamResult (new FileOutputStream12 ( fo ldername + l o g f i l e ) ) ) ;13 } catch ( Trans formerConf igurat ionExcept ion e ) {14 e . pr intStackTrace ( ) ;15 } catch ( TransformerException e ) {16 e . pr intStackTrace ( ) ;17 } catch ( FileNotFoundException e ) {18 e . pr intStackTrace ( ) ;19 }20 }

Listing 4.5: The xmltohtml()-method

4.3 Transforming T3DocML to PDF

This transformation is done similar to the one in the previous section by the xmltopdf()-method, with the additional use of Apache FOP to create the PDF file from the XSL-FOcode. The complete XSL stylesheet used for this transformation can be found in Listing7.3.

34

Page 39: Bachelorarbeit Documentation Generation for TTCN-3 filefor automatic documentation generation from TTCN-3 source code using a standardized ... Softwaredokumentation ist ein wichtiger

5 Conclusion

This thesis presented an approach for automatic documentation generation from TTCN-3source code using a standardized documentation comment specification. A prototypicalimplementation of this approach was successfully tested on several TTCN-3 test suites [22]of industrial size by ETSI and generated technical documentation that uses information fromT3Doc documentation blocks. The tool utilizes methods of the eclipse plug-in TRex, whichprovides an analysis infrastructure for TTCN-3, the open source Saxon XSLT processor, andApache FOP. For example, tested on ETSI’s SIP test suite (v4.2.5, 2,24 MB, 8 files, about62.000 lines of code), 2.229 documentation files were generated in 359.194ms (6 minutes) ona system with 2,4 GHz Dual Core and 2 GB RAM.

The source code and source code comments are correctly processed from the TTCN-3 filesand the cross-references in the HTML documentation are properly set. Cross-references inthe PDF documentation are currently not implemented, but are possible by modifying theXSL stylesheet that is used to generate the XSL-FO file.

35

Page 40: Bachelorarbeit Documentation Generation for TTCN-3 filefor automatic documentation generation from TTCN-3 source code using a standardized ... Softwaredokumentation ist ein wichtiger

Bibliography

[1] ETSI. ETSI standard ES 201 873-1: The Testing and Test Control Notation version3; Part 1: TTCN-3 Core Language, 2009.

[2] T. Bray, J. Paoli, C.M. Sperberg-McQueen, E. Maler, and F. Yergeau. Extensi-ble Markup Language (XML) 1.0 (Fifth Edition). http://www.w3.org/TR/2008/REC-xml-20081126, 2008.

[3] H.S. Thompson, D. Beech, M. Maloney, and N. Mendelsohn. XML SchemaPart 1: Structures Second Edition. http://www.w3.org/TR/2004/REC-xmlschema-1-20041028, 2004.

[4] J. Clark. XSL Transformations (XSLT). http://www.w3.org/TR/1999/REC-xslt-19991116, 1999.

[5] A. Berglund. Extensible Stylesheet Language (XSL) Version 1.1. http://www.w3.org/TR/2006/REC-xsl11-20061205, 2006.

[6] C. Willcock, T. Deiß, S. Tobies, S. Keil, F. Engler, and S. Schulz. An Introduction toTTCN-3. Wiley and Sons, 2005.

[7] International Organization for Standardization. International standard; ISO/IEC9646-3: Information technology – Open Systems Interconnection – Conformance test-ing methodology and framework – Part 3: The Tree and Tabular Combined Notation(TTCN). Technical report, 1998.

[8] ETSI. ETSI standard ES 201 873-10: The Testing and Test Control Notation version3; Part 10: TTCN-3 Documentation Comment Specification, 2008.

[9] International Organization for Standardization. International standard; ISO 8879:Information processing – Text and office systems – Standard Generalized MarkupLanguage (SGML). Technical report, 1986.

[10] S. Pemberton, D. Austin, J. Axelsson, T. Celik, D. Dominiak, H. Elenbaas, B. Ep-person, M. Ishikawa, S. Matsui, S. McCarron, A. Navaron, S. Peruvemba, R. Relyea,S. Schnitzenbaumer, and P. Stark. XHTML 1.0 The Extensible HyperText MarkupLanguage (Second Edition). http://www.w3.org/TR/2002/REC-xhtml1-20020801,2002.

36

Page 41: Bachelorarbeit Documentation Generation for TTCN-3 filefor automatic documentation generation from TTCN-3 source code using a standardized ... Softwaredokumentation ist ein wichtiger

Bibliography

[11] D. Winer. Really Simple Syndication 2.0. http://cyber.law.harvard.edu/rss/rss.html, 2002.

[12] D.Beckett. RDF/XML Syntax Specification. http://www.w3.org/TR/2004/REC-rdf-syntax-grammar-20040210, 2004.

[13] D.L. McGuinness and F. van Harmelen. OWL Web Ontology Language. http://www.w3.org/TR/2004/REC-owl-features-20040210, 2004.

[14] D. Ragget, A. Le Hors, and I. Jacobs. HTML 4.01 Specification. http://www.w3.org/TR/1999/REC-html401-19991224, 1999.

[15] J. Clark and S. DeRose. XML Path Language (XPath). http://www.w3.org/TR/1999/REC-xpath-19991116, 1999.

[16] International Organization for Standardization. International standard; ISO 32000-1:Document management – Portable document format – Part 1: PDF 1.7. Technicalreport, 2008.

[17] ECMA. ECMAScript Language Specification. http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-262.pdf, 1999.

[18] B. Zeiß, H. Neukirchen, J. Grabowski, D. Evans, and P. Baker. Refactoring and Met-rics for TTCN-3 Test Suites. In System Analysis and Modeling: Language Profiles,pages 148–165. Springer, 2006.

[19] SAXON XSLT processor. URL http://saxon.sourceforge.net.

[20] Apache FOP. URL http://xmlgraphics.apache.org/fop.

[21] E. Gamma, R. Helm, R. Johnson, and J. Vlissides. Design Patterns: Abstraction andReuse of Object-Oriented Design. 1993.

[22] Public TTCN-3 Test Suites. URL http://www.ttcn-3.org/PublicTTCN3TestSuites.htm.

37

Page 42: Bachelorarbeit Documentation Generation for TTCN-3 filefor automatic documentation generation from TTCN-3 source code using a standardized ... Softwaredokumentation ist ein wichtiger

6 Acronyms

AST Abstract Syntax Tree

DTD Document Type Definition

ETSI European Telecommunications Standards Institute

HTML Hypertext Markup Language

PDF Portable Document Format

SGML Standard Generalized Markup Language

SUT system under test

TTCN-2 Tree and Tabular Combined Notation Version 2

TTCN-3 Testing and Test Control Notation Version 3

W3C World Wide Web Consortium

XML Extensible Markup Language

XSLT Extensible Stylesheet Language Transformations

XSD XML Schema Definition

XSL-FO Extensible Stylesheet Language Formatting Objects

38

Page 43: Bachelorarbeit Documentation Generation for TTCN-3 filefor automatic documentation generation from TTCN-3 source code using a standardized ... Softwaredokumentation ist ein wichtiger

7 Annex

7.1 XML Schema

0 <?xml version=”1 .0 ” encoding=”UTF−8” ?>1 <xs:schema xmlns :xs=”ht tp : //www.w3 . org /2001/XMLSchema”>2 <xs : e l ement name=”author ”>3 <xs:complexType mixed=”true ”>4 <x s : c h o i c e>5 <xs : e l ement r e f=”e s e e ” />6 <xs : e l ement r e f=”eu r l ” />7 </ x s : c h o i c e>8 </xs:complexType>9 </ xs : e l ement>

10 <xs : e l ement name=”behaviour ”>11 <xs:complexType mixed=”true ”>12 <x s : c h o i c e>13 <xs : e l ement r e f=”newl ine ” />14 </ x s : c h o i c e>15 </xs:complexType>16 </ xs : e l ement>17 <xs : e l ement name=”s i gn ”>18 <xs:complexType mixed=”true ” />19 </ xs : e l ement>20 <xs : e l ement name=”comment”>21 <xs:complexType>22 <x s : c h o i c e>23 <xs : e l ement r e f=”author ” />24 <xs : e l ement r e f=”con f i g ” />25 <xs : e l ement r e f=”desc ” />26 <xs : e l ement r e f=”except ion ” />27 <xs : e l ement r e f=”member” />28 <xs : e l ement r e f=”param” />29 <xs : e l ement r e f=”purpose ” />30 <xs : e l ement r e f=”remark ” />31 <xs : e l ement r e f=”return ” />32 <xs : e l ement r e f=”see ” />33 <xs : e l ement r e f=”s i n c e ” />34 <xs : e l ement r e f=”s t a tu s ” />35 <xs : e l ement r e f=”u r l ” />36 <xs : e l ement r e f=”ve rd i c t ” />37 <xs : e l ement r e f=”ve r s i on ” />

39

Page 44: Bachelorarbeit Documentation Generation for TTCN-3 filefor automatic documentation generation from TTCN-3 source code using a standardized ... Softwaredokumentation ist ein wichtiger

7 Annex

38 </ x s : c h o i c e>39 </xs:complexType>40 </ xs : e l ement>41 <xs : e l ement name=”con f i g ”>42 <xs:complexType mixed=”true ”>43 <x s : c h o i c e>44 <xs : e l ement r e f=”e s e e ” />45 <xs : e l ement r e f=”eu r l ” />46 </ x s : c h o i c e>47 </xs:complexType>48 </ xs : e l ement>49 <xs : e l ement name=”desc ”>50 <xs:complexType mixed=”true ”>51 <x s : c h o i c e>52 <xs : e l ement r e f=”e s e e ” />53 <xs : e l ement r e f=”eu r l ” />54 </ x s : c h o i c e>55 </xs:complexType>56 </ xs : e l ement>57 <xs : e l ement name=”element ”>58 <xs:complexType>59 <xs : s equence>60 <xs : e l ement r e f=”name” />61 <xs : e l ement r e f=” l o c a t i o n ” />62 <xs : e l ement r e f=”comment” minOccurs=”0 ” />63 <xs : e l ement r e f=”behaviour ” />64 <xs : e l ement r e f=”s i gn ” />65 </ xs : s equence>66 <x s : a t t r i b u t e name=”type ” type=”x s : s t r i n g ” use=”requ i r ed ” />67 </xs:complexType>68 </ xs : e l ement>69 <xs : e l ement name=”esee ”>70 <xs:complexType mixed=”true ” />71 </ xs : e l ement>72 <xs : e l ement name=”eu r l ”>73 <xs:complexType mixed=”true ” />74 </ xs : e l ement>75 <xs : e l ement name=”except ion ”>76 <xs:complexType mixed=”true ”>77 <x s : c h o i c e>78 <xs : e l ement r e f=”e s e e ” />79 <xs : e l ement r e f=”eu r l ” />80 </ x s : c h o i c e>81 </xs:complexType>82 </ xs : e l ement>83 <xs : e l ement name=” f i l e ”>84 <xs:complexType mixed=”true ” />85 </ xs : e l ement>86 <xs : e l ement name=”group ”>

40

Page 45: Bachelorarbeit Documentation Generation for TTCN-3 filefor automatic documentation generation from TTCN-3 source code using a standardized ... Softwaredokumentation ist ein wichtiger

7 Annex

87 <xs:complexType>88 <xs : s equence>89 <xs : e l ement r e f=”name” />90 <xs : e l ement r e f=” l o c a t i o n ” />91 <xs : e l ement r e f=”comment” minOccurs=”0 ” />92 <x s : c h o i c e>93 <xs : e l ement r e f=”group ” />94 <xs : e l ement r e f=”element ” />95 </ x s : c h o i c e>96 </ xs : s equence>97 </xs:complexType>98 </ xs : e l ement>99 <xs : e l ement name=” l o c a t i o n ”>

100 <xs:complexType mixed=”true ” />101 </ xs : e l ement>102 <xs : e l ement name=”member”>103 <xs:complexType mixed=”true ”>104 <x s : c h o i c e>105 <xs : e l ement r e f=”e s e e ” />106 <xs : e l ement r e f=”eu r l ” />107 </ x s : c h o i c e>108 </xs:complexType>109 </ xs : e l ement>110 <xs : e l ement name=”module ”>111 <xs:complexType>112 <xs : s equence>113 <xs : e l ement r e f=”name” />114 <xs : e l ement r e f=”comment” minOccurs=”0 ” />115 <x s : c h o i c e>116 <xs : e l ement r e f=”group ” />117 <xs : e l ement r e f=”element ” />118 </ x s : c h o i c e>119 </ xs : s equence>120 </xs:complexType>121 </ xs : e l ement>122 <xs : e l ement name=”name”>123 <xs:complexType mixed=”true ” />124 </ xs : e l ement>125 <xs : e l ement name=”newl ine ” type=”x s : s t r i n g ” />126 <xs : e l ement name=”param”>127 <xs:complexType mixed=”true ”>128 <x s : c h o i c e>129 <xs : e l ement r e f=”e s e e ” />130 <xs : e l ement r e f=”eu r l ” />131 </ x s : c h o i c e>132 </xs:complexType>133 </ xs : e l ement>134 <xs : e l ement name=”p ro j e c t ”>135 <xs:complexType>

41

Page 46: Bachelorarbeit Documentation Generation for TTCN-3 filefor automatic documentation generation from TTCN-3 source code using a standardized ... Softwaredokumentation ist ein wichtiger

7 Annex

136 <xs : s equence>137 <xs : e l ement r e f=” f i l e ” minOccurs=”0 ” maxOccurs=”unbounded ” />138 <xs : e l ement r e f=”module ” minOccurs=”0 ” maxOccurs=”unbounded ” />139 </ xs : s equence>140 </xs:complexType>141 </ xs : e l ement>142 <xs : e l ement name=”purpose ”>143 <xs:complexType mixed=”true ”>144 <x s : c h o i c e>145 <xs : e l ement r e f=”e s e e ” />146 <xs : e l ement r e f=”eu r l ” />147 </ x s : c h o i c e>148 </xs:complexType>149 </ xs : e l ement>150 <xs : e l ement name=”remark ”>151 <xs:complexType mixed=”true ”>152 <x s : c h o i c e>153 <xs : e l ement r e f=”e s e e ” />154 <xs : e l ement r e f=”eu r l ” />155 </ x s : c h o i c e>156 </xs:complexType>157 </ xs : e l ement>158 <xs : e l ement name=”return ”>159 <xs:complexType mixed=”true ”>160 <x s : c h o i c e>161 <xs : e l ement r e f=”e s e e ” />162 <xs : e l ement r e f=”eu r l ” />163 </ x s : c h o i c e>164 </xs:complexType>165 </ xs : e l ement>166 <xs : e l ement name=”see ”>167 <xs:complexType mixed=”true ” />168 </ xs : e l ement>169 <xs : e l ement name=”s i n c e ”>170 <xs:complexType mixed=”true ”>171 <x s : c h o i c e>172 <xs : e l ement r e f=”e s e e ” />173 <xs : e l ement r e f=”eu r l ” />174 </ x s : c h o i c e>175 </xs:complexType>176 </ xs : e l ement>177 <xs : e l ement name=”s ta tu s ”>178 <xs:complexType mixed=”true ”>179 <x s : c h o i c e>180 <xs : e l ement r e f=”e s e e ” />181 <xs : e l ement r e f=”eu r l ” />182 </ x s : c h o i c e>183 </xs:complexType>184 </ xs : e l ement>

42

Page 47: Bachelorarbeit Documentation Generation for TTCN-3 filefor automatic documentation generation from TTCN-3 source code using a standardized ... Softwaredokumentation ist ein wichtiger

7 Annex

185 <xs : e l ement name=”ur l ”>186 <xs:complexType mixed=”true ”>187 <x s : c h o i c e>188 <xs : e l ement r e f=”e s e e ” />189 <xs : e l ement r e f=”eu r l ” />190 </ x s : c h o i c e>191 </xs:complexType>192 </ xs : e l ement>193 <xs : e l ement name=”ve rd i c t ”>194 <xs:complexType mixed=”true ”>195 <x s : c h o i c e>196 <xs : e l ement r e f=”e s e e ” />197 <xs : e l ement r e f=”eu r l ” />198 </ x s : c h o i c e>199 </xs:complexType>200 </ xs : e l ement>201 <xs : e l ement name=”ve r s i on ”>202 <xs:complexType mixed=”true ”>203 <x s : c h o i c e>204 <xs : e l ement r e f=”e s e e ” />205 <xs : e l ement r e f=”eu r l ” />206 </ x s : c h o i c e>207 </xs:complexType>208 </ xs : e l ement>209 </xs:schema>

Listing 7.1: The T3DocML Schema

7.2 XSL Stylesheet - HTML

0 <?xml version=”1 .0 ”?>1 <x s l : s t y l e s h e e t xmlns :x s l=”ht tp : //www.w3 . org /1999/XSL/Transform ”2 xmlns=”ht tp : //www.w3 . org /1999/ xhtml ” version=”2 .0 ”>3 <x s l : ou tpu t method=”xml ” indent=”yes ” name=”html ”4 doctype−pub l i c=”−//W3C//DTD XHTML 1.1//EN”5 doctype−system=”ht tp : //www.w3 . org /TR/xhtml11/DTD/xhtml11 . dtd ”/>67 <xs l :param name=” f o l d e r ”/>89 <x s l : t emp l a t e match=”/ ”>

1011 <x s l : f o r −each s e l e c t=”// element ”>12 <x s l : v a r i a b l e name=”f i l ename ”13 s e l e c t=”concat ( ’ f i l e : / ’ , $ f o l d e r , ’/ html / ’ , l o c a t i o n / text ( ) ) ”/>14 <x s l : v a l u e−o f s e l e c t=”$ f i l ename ”/>15 <x s l : r e s u l t −document h r e f=”{$ f i l ename } ” format=”html ”>16

43

Page 48: Bachelorarbeit Documentation Generation for TTCN-3 filefor automatic documentation generation from TTCN-3 source code using a standardized ... Softwaredokumentation ist ein wichtiger

7 Annex

17 <html xmlns=”ht tp : //www.w3 . org /1999/ xhtml ” xml:lang=”en ”>18 <head>19 <meta http−equiv=”Content−Type” content=”text /html ; cha r s e t=utf−8”/>20 < l i n k r e l=” s t y l e s h e e t ” type=”text / c s s ” h r e f=”c s s /doc . c s s ”/>21 <s c r i p t type=”text / j a v a s c r i p t ” s r c=” j s /doc . j s ”></ s c r i p t>22 < t i t l e><xs l : copy−o f s e l e c t=”name/ text ( ) ”/></ t i t l e>23 </head>2425 <body onload=” i n i t ( ’{@type } ’ ) ”>26 <t ab l e id=” t a b l e a l l ”><t r>27 <td id=” t a b l e a l l l e f t ”>28 <x s l : c a l l −template name=”complete index ”>29 <xs l :w i th−param name=”th i s ” s e l e c t=”ance s to r : :modu l e ”/>30 </ x s l : c a l l −template>31 </ td>32 <td id=” t a b l e a l l r i g h t ”>33 <x s l : c a l l −template name=”header ”>34 <xs l :w i th−param name=”th i s ” s e l e c t=” . ”/>35 </ x s l : c a l l −template>36 <x s l : c a l l −template name=”element withcomment ”>37 <xs l :w i th−param name=”th i s ” s e l e c t=” . ”/>38 </ x s l : c a l l −template>39 </ td>40 </ t r>41 </ tab l e>42 </body>43 </html>44 </ x s l : r e s u l t −document>45 </ x s l : f o r −each>4647 <x s l : f o r −each s e l e c t=”//module ”>48 <x s l : v a r i a b l e name=”f i l ename ”49 s e l e c t=”concat ( ’ f i l e : / ’ , $ f o l d e r , ’/ html / ’ , name/ text ( ) , ’ . html ’ ) ”/>50 <x s l : v a l u e−o f s e l e c t=”$ f i l ename ”/>51 <x s l : r e s u l t −document h r e f=”{$ f i l ename } ” format=”html ”>5253 <html xmlns=”ht tp : //www.w3 . org /1999/ xhtml ” xml:lang=”en ”>54 <head>55 <meta http−equiv=”Content−Type” content=”text /html ; cha r s e t=utf−8”/>56 < l i n k r e l=” s t y l e s h e e t ” type=”text / c s s ” h r e f=”c s s /doc . c s s ”/>57 <s c r i p t type=”text / j a v a s c r i p t ” s r c=” j s /doc . j s ”></ s c r i p t>58 < t i t l e><xs l : copy−o f s e l e c t=”name/ text ( ) ”/></ t i t l e>59 </head>60 <body onload=” i n i t ( ’ module ’ ) ”>61 <t ab l e id=” t a b l e a l l ”><t r>62 <td id=” t a b l e a l l l e f t ”>63 <x s l : c a l l −template name=”complete index ”>64 <xs l :w i th−param name=”th i s ” s e l e c t=” . ”/>65 </ x s l : c a l l −template>

44

Page 49: Bachelorarbeit Documentation Generation for TTCN-3 filefor automatic documentation generation from TTCN-3 source code using a standardized ... Softwaredokumentation ist ein wichtiger

7 Annex

66 </ td>67 <td id=” t a b l e a l l r i g h t ”>68 <x s l : c a l l −template name=”header ”>69 <xs l :w i th−param name=”th i s ” s e l e c t=” . ”/>70 </ x s l : c a l l −template>71 <div id=”d iv content ”>72 <xs l : app ly−templates s e l e c t=”comment”/>73 <div id=”div e lement ”>74 <x s l : c a l l −template name=”module behaviour ”>75 <xs l :w i th−param name=”th i s ” s e l e c t=” . ”/>76 </ x s l : c a l l −template>77 </ div>78 </ div>79 </ td>80 </ t r>81 </ tab l e>8283 </body>84 </html>85 </ x s l : r e s u l t −document>86 </ x s l : f o r −each>8788 <x s l : f o r −each s e l e c t=”//group ”>89 <x s l : v a r i a b l e name=”f i l ename ”90 s e l e c t=”concat ( ’ f i l e : / ’ , $ f o l d e r , ’/ html / ’ , l o c a t i o n / text ( ) ) ”/>91 <x s l : v a l u e−o f s e l e c t=”$ f i l ename ”/>92 <x s l : r e s u l t −document h r e f=”{$ f i l ename } ” format=”html ”>9394 <html xmlns=”ht tp : //www.w3 . org /1999/ xhtml ” xml:lang=”en ”>95 <head>96 <meta http−equiv=”Content−Type” content=”text /html ; cha r s e t=utf−8”/>97 < l i n k r e l=” s t y l e s h e e t ” type=”text / c s s ” h r e f=”c s s /doc . c s s ”/>98 <s c r i p t type=”text / j a v a s c r i p t ” s r c=” j s /doc . j s ”></ s c r i p t>99 < t i t l e><xs l : copy−o f s e l e c t=”name/ text ( ) ”/></ t i t l e>

100 </head>101102 <body onload=” i n i t ( ’ group ’ ) ”>103 <t ab l e id=” t a b l e a l l ”><t r>104 <td id=” t a b l e a l l l e f t ”>105 <x s l : c a l l −template name=”complete index ”>106 <xs l :w i th−param name=”th i s ” s e l e c t=”ance s to r : :modu l e ”/>107 </ x s l : c a l l −template>108 </ td>109 <td id=” t a b l e a l l r i g h t ”>110 <x s l : c a l l −template name=”header ”>111 <xs l :w i th−param name=”th i s ” s e l e c t=” . ”/>112 </ x s l : c a l l −template>113 <div id=”d iv content ”>114 <xs l : app ly−templates s e l e c t=”comment”/>

45

Page 50: Bachelorarbeit Documentation Generation for TTCN-3 filefor automatic documentation generation from TTCN-3 source code using a standardized ... Softwaredokumentation ist ein wichtiger

7 Annex

115 <div id=”div e lement ”>116 <x s l : c a l l −template name=”group behaviour ”>117 <xs l :w i th−param name=”th i s ” s e l e c t=” . ”/>118 </ x s l : c a l l −template>119 </ div>120 </ div>121 </ td>122 </ t r>123 </ tab l e>124125 </body>126 </html>127 </ x s l : r e s u l t −document>128 </ x s l : f o r −each>129130 <x s l : f o r −each s e l e c t=”// p r o j e c t ”>131 <x s l : v a r i a b l e name=”f i l ename ”132 s e l e c t=”concat ( ’ f i l e : / ’ , $ f o l d e r , ’/ html/ index . html ’ ) ”/>133 <x s l : v a l u e−o f s e l e c t=”$ f i l ename ”/>134 <x s l : r e s u l t −document h r e f=”{$ f i l ename } ” format=”html ”>135136 <html xmlns=”ht tp : //www.w3 . org /1999/ xhtml ” xml:lang=”en ”>137 <head>138 <meta http−equiv=”Content−Type” content=”text /html ; cha r s e t=utf−8”/>139 < l i n k r e l=” s t y l e s h e e t ” type=”text / c s s ” h r e f=”c s s /doc . c s s ”/>140 <s c r i p t type=”text / j a v a s c r i p t ” s r c=” j s /doc . j s ”></ s c r i p t>141 < t i t l e>Index</ t i t l e>142 </head>143144 <body onload=” i n i t ( ) ”>145 <t ab l e id=” t a b l e a l l ”><t r>146 <td id=” t a b l e a l l l e f t ”>147 <x s l : c a l l −template name=”complete index ”>148 <xs l :w i th−param name=”th i s ” s e l e c t=”//module ”/>149 </ x s l : c a l l −template>150 </ td>151 <td id=” t a b l e a l l r i g h t ”>152 </ td>153 </ t r>154 </ tab l e>155 </body>156 </html>157 </ x s l : r e s u l t −document>158 </ x s l : f o r −each>159 </ x s l : t emp l a t e>160161 <x s l : t emp l a t e match=”comment”>162 <div id=”div comment ”>163 <xs l : app ly−templates s e l e c t=”desc ”/>

46

Page 51: Bachelorarbeit Documentation Generation for TTCN-3 filefor automatic documentation generation from TTCN-3 source code using a standardized ... Softwaredokumentation ist ein wichtiger

7 Annex

164 < x s l : i f t e s t=”author ”>165 <p c l a s s=”comment headline ”>Author ( s ) :</p>166 <ul c l a s s=”comment l i s t ”>167 <xs l : app ly−templates s e l e c t=”author ”/>168 </ u l>169 </ x s l : i f>170 < x s l : i f t e s t=”con f i g ”>171 <p c l a s s=”comment headline ”>Conf i g :</p>172 <ul c l a s s=”comment l i s t ”>173 <xs l : app ly−templates s e l e c t=”con f i g ”/>174 </ u l>175 </ x s l : i f>176 < x s l : i f t e s t=”except ion ”>177 <p c l a s s=”comment headline ”>Exception ( s ) :</p>178 <ul c l a s s=”comment l i s t ”>179 <xs l : app ly−templates s e l e c t=”except ion ”/>180 </ u l>181 </ x s l : i f>182 < x s l : i f t e s t=”member”>183 <p c l a s s=”comment headline ”>Member( s ) :</p>184 <ul c l a s s=”comment l i s t ”>185 <xs l : app ly−templates s e l e c t=”member”/>186 </ u l>187 </ x s l : i f>188 < x s l : i f t e s t=”param”>189 <p c l a s s=”comment headline ”>Parameter ( s ) :</p>190 <ul c l a s s=”comment l i s t ”>191 <xs l : app ly−templates s e l e c t=”param”/>192 </ u l>193 </ x s l : i f>194 < x s l : i f t e s t=”purpose ”>195 <p c l a s s=”comment headline ”>Purpose :</p>196 <ul c l a s s=”comment l i s t ”>197 <xs l : app ly−templates s e l e c t=”purpose ”/>198 </ u l>199 </ x s l : i f>200 < x s l : i f t e s t=”remark ”>201 <p c l a s s=”comment headline ”>Remark( s ) :</p>202 <ul c l a s s=”comment l i s t ”>203 <xs l : app ly−templates s e l e c t=”remark ”/>204 </ u l>205 </ x s l : i f>206 < x s l : i f t e s t=”return ”>207 <p c l a s s=”comment headline ”>Return:</p>208 <ul c l a s s=”comment l i s t ”>209 <xs l : app ly−templates s e l e c t=”return ”/>210 </ u l>211 </ x s l : i f>212 < x s l : i f t e s t=”see ”>

47

Page 52: Bachelorarbeit Documentation Generation for TTCN-3 filefor automatic documentation generation from TTCN-3 source code using a standardized ... Softwaredokumentation ist ein wichtiger

7 Annex

213 <p c l a s s=”comment headline ”>See :</p>214 <ul c l a s s=”comment l i s t ”>215 <xs l : app ly−templates s e l e c t=”see ”/>216 </ u l>217 </ x s l : i f>218 < x s l : i f t e s t=”s i n c e ”>219 <p c l a s s=”comment headline ”>S i n c e :</p>220 <ul c l a s s=”comment l i s t ”>221 <xs l : app ly−templates s e l e c t=”s i n c e ”/>222 </ u l>223 </ x s l : i f>224 < x s l : i f t e s t=”s ta tu s ”>225 <p c l a s s=”comment headline ”>S ta tu s :</p>226 <ul c l a s s=”comment l i s t ”>227 <xs l : app ly−templates s e l e c t=”s ta tu s ”/>228 </ u l>229 </ x s l : i f>230 < x s l : i f t e s t=”u r l ”>231 <p c l a s s=”comment headline ”>Url ( s ) :</p>232 <ul c l a s s=”comment l i s t ”>233 <xs l : app ly−templates s e l e c t=”u r l ”/>234 </ u l>235 </ x s l : i f>236 < x s l : i f t e s t=”ve rd i c t ”>237 <p c l a s s=”comment headline ”>Verdict ( s ) :</p>238 <ul c l a s s=”comment l i s t ”>239 <xs l : app ly−templates s e l e c t=”ve rd i c t ”/>240 </ u l>241 </ x s l : i f>242 < x s l : i f t e s t=”ve r s i on ”>243 <p c l a s s=”comment headline ”>Ver s i on :</p>244 <ul c l a s s=”comment l i s t ”>245 <xs l : app ly−templates s e l e c t=”ve r s i on ”/>246 </ u l>247 </ x s l : i f>248 </ div>249 </ x s l : t emp l a t e>250251 <x s l : t emp l a t e match=”desc ”>252 <p c l a s s=”comment desc l ine ”><xs l : app ly−templates /></p>253 </ x s l : t emp l a t e>254255 <x s l : t emp l a t e match=”author | re turn | remark | param |256 s i n c e | s t a tu s | u r l | v e rd i c t | ve r s i on | member |257 con f i g | except ion | purpose | s i n c e ”>258 < l i c l a s s=”comment l i s t i tem ”><xs l : app ly−templates /></ l i>259 </ x s l : t emp l a t e>260261

48

Page 53: Bachelorarbeit Documentation Generation for TTCN-3 filefor automatic documentation generation from TTCN-3 source code using a standardized ... Softwaredokumentation ist ein wichtiger

7 Annex

262 <x s l : t emp l a t e match=”see ”>263 <x s l : v a r i a b l e name=”text ” s e l e c t=”normal ize−space ( t ext ( ) ) ” />264 <x s l : c h o o s e>265 <xs l :when t e s t=”conta in s ($ text , ’ . ’ ) ”>266 <x s l : v a r i a b l e name=” f i l e ” s e l e c t=”/ p r o j e c t / f i l e [ conta in s ( t ext ( ) ,267 concat ( ’ e ’ , subs t r ing−a f t e r ($ text , ’ . ’ ) , ’ . html ’ ) ) and conta in s ( t ext ( ) ,268 concat ( ’ m ’ , subs t r ing−be f o r e ($ text , ’ . ’ ) , ’ o ’ ) ) ] ”/>269 < x s l : i f t e s t=”$ f i l e ”>270 < l i c l a s s=”comment l i s t i tem ”>271 <a h r e f=”{$ f i l e / t ext ( )} ”><xs l : copy−o f s e l e c t=”$ text ”/></a>272 </ l i>273 </ x s l : i f>274 < x s l : i f t e s t=”not ($ f i l e ) ”>275 < l i c l a s s=”comment l i s t i tem ”><xs l : copy−o f s e l e c t=”text ( ) ”/></ l i>276 </ x s l : i f>277 </ xs l :when>278 <x s l : o t h e rw i s e>279 <x s l : v a r i a b l e name=” f i l e ”280 s e l e c t=”/ p r o j e c t / f i l e [ conta in s ( t ext ( ) , concat ( ’ e ’ , $ text , ’ . html ’ ) ) ] ”/>281 < x s l : i f t e s t=”$ f i l e ”>282 < l i c l a s s=”comment l i s t i tem ”>283 <a h r e f=”{$ f i l e / t ext ( )} ”><xs l : copy−o f s e l e c t=”$ text ”/></a>284 </ l i>285 </ x s l : i f>286 < x s l : i f t e s t=”not ($ f i l e ) ”>287 < l i c l a s s=”comment l i s t i tem ”><xs l : copy−o f s e l e c t=”text ( ) ”/></ l i>288 </ x s l : i f>289 </ x s l : o t h e rw i s e>290 </ x s l : c h o o s e>291 </ x s l : t emp l a t e>292293 <x s l : t emp l a t e match=”esee ”>294 <x s l : v a r i a b l e name=”text ” s e l e c t=”normal ize−space ( t ext ( ) ) ” />295 <x s l : c h o o s e>296 <xs l :when t e s t=”conta in s ($ text , ’ . ’ ) ”>297 <x s l : v a r i a b l e name=” f i l e ” s e l e c t=”/ p r o j e c t / f i l e [ conta in s ( t ext ( ) ,298 concat ( ’ e ’ , subs t r ing−a f t e r ($ text , ’ . ’ ) , ’ . html ’ ) ) and conta in s ( t ext ( ) ,299 concat ( ’ m ’ , subs t r ing−be f o r e ($ text , ’ . ’ ) , ’ o ’ ) ) ] ”/>300 < x s l : i f t e s t=”$ f i l e ”>301 <a h r e f=”{$ f i l e / t ext ( )} ”><xs l : copy−o f s e l e c t=”$ text ”/></a>302 </ x s l : i f>303 < x s l : i f t e s t=”not ($ f i l e ) ”>304 <xs l : copy−o f s e l e c t=”text ( ) ”/>305 </ x s l : i f>306 </ xs l :when>307 <x s l : o t h e rw i s e>308 <x s l : v a r i a b l e name=” f i l e ” s e l e c t=”/ p r o j e c t / f i l e [ conta in s ( t ext ( ) ,309 concat ( ’ e ’ , $ text , ’ . html ’ ) ) ] ”/>310 < x s l : i f t e s t=”$ f i l e ”>

49

Page 54: Bachelorarbeit Documentation Generation for TTCN-3 filefor automatic documentation generation from TTCN-3 source code using a standardized ... Softwaredokumentation ist ein wichtiger

7 Annex

311 <a h r e f=”{$ f i l e / t ext ( )} ”><xs l : copy−o f s e l e c t=”$ text ”/></a>312 </ x s l : i f>313 < x s l : i f t e s t=”not ($ f i l e ) ”>314 <xs l : copy−o f s e l e c t=”text ( ) ”/>315 </ x s l : i f>316 </ x s l : o t h e rw i s e>317 </ x s l : c h o o s e>318 <xs l : copy−o f s e l e c t=” ’ ’ ”/>319 </ x s l : t emp l a t e>320321 <x s l : t emp l a t e match=”behaviour ”>322 <div c l a s s=”div behav iour ”>323 <p c l a s s=”statement ”>324 <xs l : app ly−templates />325 </p>326 </ div>327 </ x s l : t emp l a t e>328329 <x s l : t emp l a t e match=”newl ine ”>330 <br/>331 </ x s l : t emp l a t e>332333 <x s l : t emp l a t e match=” l i n k ”>334 <x s l : v a r i a b l e name=” l o c ” s e l e c t=”@loc ” />335336 <x s l : c h o o s e>337 <xs l :when t e s t=”not (/ p r o j e c t / f i l e [ t ex t ( ) eq $ l o c ] ) ”>338 <xs l : copy−o f339 s e l e c t=”r ep l a c e ( r ep l a c e ( t ext ( ) , ’ ’ , ’&#160; ’) , ’\ t ’ , ’&#x9 ; ’ ) ”/>340 </ xs l :when>341 <x s l : o t h e rw i s e>342 <a h r e f=”{@loc} ”>343 <xs l : copy−o f344 s e l e c t=”r ep l a c e ( r ep l a c e ( t ext ( ) , ’ ’ , ’&#160; ’) , ’\ t ’ , ’&#x9 ; ’ ) ”/></a>345 </ x s l : o t h e rw i s e>346 </ x s l : c h o o s e>347 </ x s l : t emp l a t e>348349350 <x s l : t emp l a t e name=”index group ”>351 <xs l :param name=”th i s ”/>352 <x s l : f o r −each s e l e c t=”$ t h i s ”>353 < l i><a h r e f=”{ l o c a t i o n / text ( )} ”><xs l : copy−o f s e l e c t=”name/ text ( ) ”/></a>354355 < x s l : i f t e s t=” . / group ”>356 <ul>357 <x s l : c a l l −template name=”index group ”>358 <xs l :w i th−param name=”th i s ” s e l e c t=” . / group ”/>359 </ x s l : c a l l −template>

50

Page 55: Bachelorarbeit Documentation Generation for TTCN-3 filefor automatic documentation generation from TTCN-3 source code using a standardized ... Softwaredokumentation ist ein wichtiger

7 Annex

360 </ u l>361 </ x s l : i f>362363364 </ l i>365 </ x s l : f o r −each>366367 </ x s l : t emp l a t e>368369370 <x s l : t emp l a t e name=”index modu l e l i s t ”>371 <p c l a s s=” index head l i n e ”><a h r e f=”index . html ”>Modules</a></p>372 <ul>373 <x s l : f o r −each s e l e c t=”//module ”>374 < l i>375 <a h r e f=”{name/ text ( ) } . html ”><xs l : copy−o f s e l e c t=”name/ text ( ) ”/></a>376 </ l i>377 </ x s l : f o r −each>378 </ ul>379 </ x s l : t emp l a t e>380381 <x s l : t emp l a t e name=” i nd ex g r oup l i s t ”>382 <xs l :param name=”th i s ”/>383 <p c l a s s=” index head l i n e ”>384 <a h r e f=”#” onc l i c k=”togg l e ( ’ u l groups ’ ) ”>Groups</a>385 </p>386 <ul id=”u l g roups ”>387 <x s l : c a l l −template name=”index group ”>388 <xs l :w i th−param name=”th i s ” s e l e c t=”$ t h i s ”/>389 </ x s l : c a l l −template>390 < x s l : i f t e s t=”not ($ t h i s ) ”>391 < l i>−</ l i>392 </ x s l : i f>393 </ u l>394 </ x s l : t emp l a t e>395396 <x s l : t emp l a t e name=” i nd ex e l emen t l i s t ”>397 <xs l :param name=”th i s ”/>398 <xs l :param name=”type ”/>399 <p c l a s s=” index head l i n e ”>400 <a h r e f=”#” onc l i c k=”togg l e ( ’ u l {$ type}s ’ ) ”>401 <xs l : copy−o f s e l e c t=”$ type ”/>s</a>402 </p>403 <ul id=”u l {$ type} s ”>404 < x s l : i f t e s t=”not ($ t h i s ) ”>405 < l i>−</ l i>406 </ x s l : i f>407 <x s l : f o r −each s e l e c t=”$ t h i s ”>408 < l i>

51

Page 56: Bachelorarbeit Documentation Generation for TTCN-3 filefor automatic documentation generation from TTCN-3 source code using a standardized ... Softwaredokumentation ist ein wichtiger

7 Annex

409 <a h r e f=”{ l o c a t i o n / text ( )} ”><xs l : copy−o f s e l e c t=”name/ text ( ) ”/></a>410 </ l i>411 </ x s l : f o r −each>412 </ u l>413 </ x s l : t emp l a t e>414415416 <x s l : t emp l a t e name=”complete index ”>417 <xs l :param name=”th i s ”/>418 <div id=”div modules ”>419 <x s l : c a l l −template name=”index modu l e l i s t ”/>420 </ div>421 <div id=”d iv index ”>422423 <x s l : c a l l −template name=” i nd ex g r oup l i s t ”>424 <xs l :w i th−param name=”th i s ” s e l e c t=”$ t h i s /group ”/>425 </ x s l : c a l l −template>426427 <x s l : c a l l −template name=” i nd ex e l emen t l i s t ”>428 <xs l :w i th−param name=”th i s ” s e l e c t=”$ t h i s // element [ @type eq ’ funct ion ’ ] ”/>429 <xs l :w i th−param name=”type ” s e l e c t=” ’ Function ’ ”/>430 </ x s l : c a l l −template>431432 <x s l : c a l l −template name=” i nd ex e l emen t l i s t ”>433 <xs l :w i th−param name=”th i s ” s e l e c t=”$ t h i s // element [ @type eq ’ type ’ ] ”/>434 <xs l :w i th−param name=”type ” s e l e c t=” ’Type ’ ”/>435 </ x s l : c a l l −template>436437 <x s l : c a l l −template name=” i nd ex e l emen t l i s t ”>438 <xs l :w i th−param name=”th i s ” s e l e c t=”$ t h i s // element [ @type eq ’ s i gnature ’ ] ”/>439 <xs l :w i th−param name=”type ” s e l e c t=” ’ Signature ’ ”/>440 </ x s l : c a l l −template>441442 <x s l : c a l l −template name=” i nd ex e l emen t l i s t ”>443 <xs l :w i th−param name=”th i s ” s e l e c t=”$ t h i s // element [ @type eq ’ t e s t c a s e ’ ] ”/>444 <xs l :w i th−param name=”type ” s e l e c t=” ’ Testcase ’ ”/>445 </ x s l : c a l l −template>446447 <x s l : c a l l −template name=” i nd ex e l emen t l i s t ”>448 <xs l :w i th−param name=”th i s ” s e l e c t=”$ t h i s // element [ @type eq ’ a l t s t ep ’ ] ”/>449 <xs l :w i th−param name=”type ” s e l e c t=” ’ Altstep ’ ”/>450 </ x s l : c a l l −template>451452 <x s l : c a l l −template name=” i nd ex e l emen t l i s t ”>453 <xs l :w i th−param name=”th i s ” s e l e c t=”$ t h i s // element [ @type eq ’ template ’ ] ”/>454 <xs l :w i th−param name=”type ” s e l e c t=” ’ Template ’ ”/>455 </ x s l : c a l l −template>456457 <x s l : c a l l −template name=” i nd ex e l emen t l i s t ”>

52

Page 57: Bachelorarbeit Documentation Generation for TTCN-3 filefor automatic documentation generation from TTCN-3 source code using a standardized ... Softwaredokumentation ist ein wichtiger

7 Annex

458 <xs l :w i th−param name=”th i s ” s e l e c t=”$ t h i s // element [ @type eq ’ constant ’ ] ”/>459 <xs l :w i th−param name=”type ” s e l e c t=” ’ Constant ’ ”/>460 </ x s l : c a l l −template>461462 <x s l : c a l l −template name=” i nd ex e l emen t l i s t ”>463 <xs l :w i th−param name=”th i s ” s e l e c t=”$ t h i s // element [ @type eq ’ parameter ’ ] ”/>464 <xs l :w i th−param name=”type ” s e l e c t=” ’ Parameter ’ ”/>465 </ x s l : c a l l −template>466467 </ div>468 </ x s l : t emp l a t e>469470471 <x s l : t emp l a t e name=”modulecontent behaviour ”>472 <xs l :param name=”th i s ”/>473 <x s l : f o r −each s e l e c t=”$ t h i s / element ”>474 <xs l : app ly−templates s e l e c t=”behaviour ”/>475 </ x s l : f o r −each>476 </ x s l : t emp l a t e>477478 <x s l : t emp l a t e name=”module behaviour ”>479 <xs l :param name=”th i s ”/>480 <p><xs l : copy−o f s e l e c t=” ’ module ’ ”/>481 <a h r e f=”{$ t h i s / l o c a t i o n / text ( )} ”>482 <xs l : copy−o f s e l e c t=”$ t h i s /name/ text ( ) ”/>483 </a>484 <xs l : copy−o f s e l e c t=” ’ { ’ ”/>485 </p>486 <div c l a s s=”div group behav iour ”>487 <x s l : f o r −each s e l e c t=”$ t h i s /group ”>488 <x s l : c a l l −template name=”group behaviour ”>489 <xs l :w i th−param name=”th i s ” s e l e c t=” . ”/>490 </ x s l : c a l l −template>491 </ x s l : f o r −each>492 <x s l : c a l l −template name=”modulecontent behaviour ”>493 <xs l :w i th−param name=”th i s ” s e l e c t=”$ t h i s ”/>494 </ x s l : c a l l −template>495 </ div>496 <p><xs l : copy−o f s e l e c t=” ’} ’ ”/></p>497 </ x s l : t emp l a t e>498499 <x s l : t emp l a t e name=”group behaviour ”>500 <xs l :param name=”th i s ”/>501 <p><xs l : copy−o f s e l e c t=” ’ group ’ ”/>502 <a h r e f=”{$ t h i s / l o c a t i o n / text ( )} ”><xs l : copy−o f s e l e c t=”$ t h i s /name/ text ( ) ”/>503 </a>504 <xs l : copy−o f s e l e c t=” ’ { ’ ”/>505 </p>506 <div c l a s s=”div group behav iour ”>

53

Page 58: Bachelorarbeit Documentation Generation for TTCN-3 filefor automatic documentation generation from TTCN-3 source code using a standardized ... Softwaredokumentation ist ein wichtiger

7 Annex

507 <x s l : f o r −each s e l e c t=”$ t h i s /group ”>508 <x s l : c a l l −template name=”group behaviour ”>509 <xs l :w i th−param name=”th i s ” s e l e c t=” . ”/>510 </ x s l : c a l l −template>511 </ x s l : f o r −each>512 <x s l : c a l l −template name=”modulecontent behaviour ”>513 <xs l :w i th−param name=”th i s ” s e l e c t=”$ t h i s ”/>514 </ x s l : c a l l −template>515 </ div>516 <p><xs l : copy−o f s e l e c t=” ’} ’ ”/></p>517 </ x s l : t emp l a t e>518519 <x s l : t emp l a t e name=”element withcomment ”>520 <xs l :param name=”th i s ”/>521 <div id=”d iv content ”>522 <xs l : app ly−templates s e l e c t=”comment”/>523524 <div id=”div e lement ”>525 <xs l : app ly−templates s e l e c t=”$ t h i s / behaviour ”/>526 </ div>527 </ div>528 </ x s l : t emp l a t e>529530 <x s l : t emp l a t e name=”header ”>531 <xs l :param name=”th i s ”/>532 <p id=”p header ”>533 < x s l : i f t e s t=”$ t h i s / ance s to r : :modu l e ”>534 <a h r e f=”{$ t h i s / ance s to r : :modu l e /name/ text ( ) } . html ”>535 <xs l : copy−o f s e l e c t=”ance s to r : :modu l e /name/ text ( ) ”/>536 </a>537 <br/>538 </ x s l : i f>539540 < x s l : i f t e s t=”$ t h i s / ance s to r : :modu l e ”><xs l : copy−o f s e l e c t=”’−> ’ ”/></ x s l : i f>541 <xs l : copy−o f s e l e c t=”$ t h i s /name/ text ( ) ”/></p>542543 </ x s l : t emp l a t e>544545 </ x s l : s t y l e s h e e t>

Listing 7.2: The XSL Stylesheet (HTML)

54

Page 59: Bachelorarbeit Documentation Generation for TTCN-3 filefor automatic documentation generation from TTCN-3 source code using a standardized ... Softwaredokumentation ist ein wichtiger

7 Annex

7.3 XSL Stylesheet - XSL-FO

0 <?xml version=”1 .0 ” encoding=”UTF−8”?>1 <x s l : s t y l e s h e e t version=”1 .0 ”2 xmlns :x s l=”ht tp : //www.w3 . org /1999/XSL/Transform ”3 xmlns : f o=”ht tp : //www.w3 . org /1999/XSL/Format ”>4 <x s l : ou tpu t method=”xml ” indent=”yes ”/>56 <x s l : t emp l a t e match=”/ ”>78 < f o : r o o t xmlns : fo=”ht tp : //www.w3 . org /1999/XSL/Format ”>9

10 <f o : l a you t−master−s e t>11 <f o : s imp l e−page−master master−name=”A4”>12 <f o : r e g i o n−body padding− l e f t=”0pt ” padding−r i g h t=”0pt ”13 padding−top=”0pt ” padding−bottom=”0pt ”/>14 </ f o : s imp l e−page−master>15 </ f o : l a you t−master−s e t>1617 <f o :page−sequence master−r e f e r e n c e=”A4”>18 < f o : f l ow flow−name=”xs l−reg ion−body ”>19 <xs l : app ly−templates s e l e c t=”//module ”/>20 </ f o : f l ow>21 </ fo :page−sequence></ f o : r o o t>2223 </ x s l : t emp l a t e>2425 <x s l : t emp l a t e name=”modulecontent ”>26 <xs l :param name=”th i s ”/>2728 < x s l : i f t e s t=”count ($ t h i s / element [ @type eq ’ funct ion ’ ] ) &gt ; 0 ”>29 < f o : b l o c k border=”3pt s o l i d black ” border−bottom−s t y l e=”hidden ”30 border−l e f t−s t y l e=”hidden ” border−r i ght−s t y l e=”hidden ” margin−top=”7pt ”>31 < f o : b l o c k text−a l i g n=” l e f t ” font−weight=”bold ” font−s i z e=”10pt ”32 margin−top=”10pt ”>33 < f o : i n l i n e>Functions</ f o : i n l i n e>34 </ f o : b l o c k>35 <xs l : app ly−templates s e l e c t=”$ t h i s / element [ @type eq ’ funct ion ’ ] ”/>36 </ f o : b l o c k>37 </ x s l : i f>3839 < x s l : i f t e s t=”count ($ t h i s / element [ @type eq ’ t e s t c a s e ’ ] ) &gt ; 0 ”>40 < f o : b l o c k border=”3pt s o l i d black ” border−bottom−s t y l e=”hidden ”41 border−l e f t−s t y l e=”hidden ” border−r i ght−s t y l e=”hidden ” margin−top=”7pt ”>42 < f o : b l o c k text−a l i g n=” l e f t ” font−weight=”bold ” font−s i z e=”10pt ”43 margin−top=”10pt ”>44 < f o : i n l i n e>Testcase s</ f o : i n l i n e>45 </ f o : b l o c k>

55

Page 60: Bachelorarbeit Documentation Generation for TTCN-3 filefor automatic documentation generation from TTCN-3 source code using a standardized ... Softwaredokumentation ist ein wichtiger

7 Annex

46 <xs l : app ly−templates s e l e c t=”$ t h i s / element [ @type eq ’ t e s t c a s e ’ ] ”/>47 </ f o : b l o c k>48 </ x s l : i f>4950 < x s l : i f t e s t=”count ($ t h i s / element [ @type eq ’ t e s t c a s e ’ ] ) &gt ; 0 ”>51 < f o : b l o c k border=”3pt s o l i d black ” border−bottom−s t y l e=”hidden ”52 border−l e f t−s t y l e=”hidden ” border−r i ght−s t y l e=”hidden ” margin−top=”7pt ”>53 < f o : b l o c k text−a l i g n=” l e f t ” font−weight=”bold ” font−s i z e=”10pt ”54 margin−top=”10pt ”>55 < f o : i n l i n e>Alt s t ep s</ f o : i n l i n e>56 </ f o : b l o c k>57 <xs l : app ly−templates s e l e c t=”$ t h i s / element [ @type eq ’ a l t s t ep ’ ] ”/>58 </ f o : b l o c k>59 </ x s l : i f>6061 < x s l : i f t e s t=”count ($ t h i s / element [ @type eq ’ t e s t c a s e ’ ] ) &gt ; 0 ”>62 < f o : b l o c k border=”3pt s o l i d black ” border−bottom−s t y l e=”hidden ”63 border−l e f t−s t y l e=”hidden ” border−r i ght−s t y l e=”hidden ” margin−top=”7pt ”>64 < f o : b l o c k text−a l i g n=” l e f t ” font−weight=”bold ” font−s i z e=”10pt ”65 margin−top=”10pt ”>66 < f o : i n l i n e>Constants</ f o : i n l i n e>67 </ f o : b l o c k>68 <xs l : app ly−templates s e l e c t=”$ t h i s / element [ @type eq ’ constant ’ ] ”/>69 </ f o : b l o c k>70 </ x s l : i f>7172 < x s l : i f t e s t=”count ($ t h i s / element [ @type eq ’ t e s t c a s e ’ ] ) &gt ; 0 ”>73 < f o : b l o c k border=”3pt s o l i d black ” border−bottom−s t y l e=”hidden ”74 border−l e f t−s t y l e=”hidden ” border−r i ght−s t y l e=”hidden ” margin−top=”7pt ”>75 < f o : b l o c k text−a l i g n=” l e f t ” font−weight=”bold ” font−s i z e=”10pt ”76 margin−top=”10pt ”>77 < f o : i n l i n e>Parameters</ f o : i n l i n e>78 </ f o : b l o c k>79 <xs l : app ly−templates s e l e c t=”$ t h i s / element [ @type eq ’ parameter ’ ] ”/>80 </ f o : b l o c k>81 </ x s l : i f>8283 < x s l : i f t e s t=”count ($ t h i s / element [ @type eq ’ t e s t c a s e ’ ] ) &gt ; 0 ”>84 < f o : b l o c k border=”3pt s o l i d black ” border−bottom−s t y l e=”hidden ”85 border−l e f t−s t y l e=”hidden ” border−r i ght−s t y l e=”hidden ” margin−top=”7pt ”>86 < f o : b l o c k text−a l i g n=” l e f t ” font−weight=”bold ” font−s i z e=”10pt ”87 margin−top=”10pt ”>88 < f o : i n l i n e>Templates</ f o : i n l i n e>89 </ f o : b l o c k>90 <xs l : app ly−templates s e l e c t=”$ t h i s / element [ @type eq ’ template ’ ] ”/>91 </ f o : b l o c k>92 </ x s l : i f>9394 < x s l : i f t e s t=”count ($ t h i s / element [ @type eq ’ t e s t c a s e ’ ] ) &gt ; 0 ”>

56

Page 61: Bachelorarbeit Documentation Generation for TTCN-3 filefor automatic documentation generation from TTCN-3 source code using a standardized ... Softwaredokumentation ist ein wichtiger

7 Annex

95 < f o : b l o c k border=”3pt s o l i d black ” border−bottom−s t y l e=”hidden ”96 border−l e f t−s t y l e=”hidden ” border−r i ght−s t y l e=”hidden ” margin−top=”7pt ”>97 < f o : b l o c k text−a l i g n=” l e f t ” font−weight=”bold ” font−s i z e=”10pt ”98 margin−top=”10pt ”>99 < f o : i n l i n e>Types</ f o : i n l i n e>

100 </ f o : b l o c k>101 <xs l : app ly−templates s e l e c t=”$ t h i s / element [ @type eq ’ type ’ ] ”/>102 </ f o : b l o c k>103 </ x s l : i f>104105 < x s l : i f t e s t=”count ($ t h i s / element [ @type eq ’ t e s t c a s e ’ ] ) &gt ; 0 ”>106 < f o : b l o c k border=”3pt s o l i d black ” border−bottom−s t y l e=”hidden ”107 border−l e f t−s t y l e=”hidden ” border−r i ght−s t y l e=”hidden ” margin−top=”7pt ”>108 < f o : b l o c k text−a l i g n=” l e f t ” font−weight=”bold ” font−s i z e=”10pt ”109 margin−top=”10pt ”>110 < f o : i n l i n e>S ignature s</ f o : i n l i n e>111 </ f o : b l o c k>112 <xs l : app ly−templates s e l e c t=”$ t h i s / element [ @type eq ’ s i gnature ’ ] ”/>113 </ f o : b l o c k>114 </ x s l : i f>115116 < x s l : i f t e s t=”count ( group ) &gt ; 0 ”>117 < f o : b l o c k border=”3pt s o l i d black ” border−bottom−s t y l e=”hidden ”118 border−l e f t−s t y l e=”hidden ” border−r i ght−s t y l e=”hidden ” margin−top=”7pt ”>119 < f o : b l o c k text−a l i g n=” l e f t ” font−weight=”bold ” font−s i z e=”10pt ”120 margin−top=”10pt ”>121 < f o : i n l i n e font−weight=”bold ”>Groups</ f o : i n l i n e>122 </ f o : b l o c k>123 <xs l : app ly−templates s e l e c t=”group ”/>124 </ f o : b l o c k>125 </ x s l : i f>126127 </ x s l : t emp l a t e>128129 <x s l : t emp l a t e match=”module ”>130 < f o : b l o c k margin−top=”30pt ” margin− l e f t=”20pt ” margin−r i g h t=”20pt ”131 padding=”10pt ” border=”1pt s o l i d black ” background−c o l o r=”#DDDDDD”132 break−be f o r e=”page ”>133 < f o : b l o c k font−s i z e=”12pt ” text−decora t i on=”unde r l i n e ” text−a l i g n=”cente r ”134 font−weight=”bold ” margin−top=”10pt ” margin−bottom=”20pt ”>135 < f o : i n l i n e>Module <xs l : copy−o f s e l e c t=”name/ text ( ) ”/></ f o : i n l i n e>136 </ f o : b l o c k>137 <xs l : app ly−templates s e l e c t=”comment”/>138 <x s l : c a l l −template name=”modulecontent ”>139 <xs l :w i th−param name=”th i s ” s e l e c t=” . ”/>140 </ x s l : c a l l −template>141 </ f o : b l o c k>142 </ x s l : t emp l a t e>143

57

Page 62: Bachelorarbeit Documentation Generation for TTCN-3 filefor automatic documentation generation from TTCN-3 source code using a standardized ... Softwaredokumentation ist ein wichtiger

7 Annex

144145 <x s l : t emp l a t e match=”group ”>146147 < f o : b l o c k margin−top=”5pt ” padding− l e f t=”5pt ” padding−r i g h t=”5pt ”148 border=”1pt s o l i d black ” background−c o l o r=”#DDDDDD” font−s i z e=”8pt ”>149 < f o : b l o c k text−a l i g n=” l e f t ” padding=”5pt ” border=”1pt s o l i d black ”150 background−c o l o r=”#BBBBFF” font−s i z e=”8pt ”>151 < f o : i n l i n e font−weight=”bold ”>152 Group <xs l : copy−o f s e l e c t=”name/ text ( ) ”/>153 </ f o : i n l i n e>154 </ f o : b l o c k>155 <xs l : app ly−templates s e l e c t=”comment”/>156 < f o : b l o c k margin− l e f t=”5pt ” margin−r i g h t=”5pt ”>157 <x s l : c a l l −template name=”modulecontent ”>158 <xs l :w i th−param name=”th i s ” s e l e c t=” . ”/>159 </ x s l : c a l l −template>160 </ f o : b l o c k>161 </ f o : b l o c k>162 </ x s l : t emp l a t e>163164 <x s l : t emp l a t e match=”element ”>165 < f o : b l o c k text−a l i g n=” l e f t ” margin−top=”10pt ” padding=”5pt ”166 border=”1pt s o l i d black ” background−c o l o r=”#BBBBFF” font−s i z e=”8pt ”>167 < f o : i n l i n e font−weight=”bold ”>168 <xs l : copy−o f s e l e c t=”s i gn / text ( ) ”/>169 </ f o : i n l i n e>170 </ f o : b l o c k>171 <xs l : app ly−templates s e l e c t=”comment”/>172 </ x s l : t emp l a t e>173174175176 <x s l : t emp l a t e match=”comment”>177 < f o : b l o c k text−a l i g n=” l e f t ” margin−bottom=”0pt ” padding=”5pt ”178 background−c o l o r=”#EEEEFF” border=”1pt s o l i d black ” font−s i z e=”8pt ”>179 < x s l : i f t e s t=”count ( desc ) &gt ; 0 ”>180 <xs l : app ly−templates s e l e c t=”desc ”/>181 </ x s l : i f>182 < f o : b l o c k margin−bottom=”18pt ”/>183184 < x s l : i f t e s t=”count (param) &gt ; 0 ”>185 < f o : i n l i n e font−weight=”bold ”>Parameter ( s ) :</ f o : i n l i n e>186 < f o : l i s t −block margin− l e f t=”30pt ”>187 <xs l : app ly−templates s e l e c t=”param”/>188 </ f o : l i s t −block>189 </ x s l : i f>190191 < x s l : i f t e s t=”count ( re turn ) &gt ; 0 ”>192 < f o : i n l i n e font−weight=”bold ”>Returns :</ f o : i n l i n e>

58

Page 63: Bachelorarbeit Documentation Generation for TTCN-3 filefor automatic documentation generation from TTCN-3 source code using a standardized ... Softwaredokumentation ist ein wichtiger

7 Annex

193 < f o : l i s t −block margin− l e f t=”30pt ”>194 <xs l : app ly−templates s e l e c t=”return ”/>195 </ f o : l i s t −block>196 </ x s l : i f>197198 < x s l : i f t e s t=”count ( author ) &gt ; 0 ”>199 < f o : i n l i n e font−weight=”bold ”>Author ( s ) :</ f o : i n l i n e>200 < f o : l i s t −block margin− l e f t=”30pt ”>201 <xs l : app ly−templates s e l e c t=”author ”/>202 </ f o : l i s t −block>203 </ x s l : i f>204205 < x s l : i f t e s t=”count ( remark ) &gt ; 0 ”>206 < f o : i n l i n e font−weight=”bold ”>Remark( s ) :</ f o : i n l i n e>207 < f o : l i s t −block margin− l e f t=”30pt ”>208 <xs l : app ly−templates s e l e c t=”remark ”/>209 </ f o : l i s t −block>210 </ x s l : i f>211212 < x s l : i f t e s t=”count ( s t a tu s ) &gt ; 0 ”>213 < f o : i n l i n e font−weight=”bold ”>S ta tu s :</ f o : i n l i n e>214 < f o : l i s t −block margin− l e f t=”30pt ”>215 <xs l : app ly−templates s e l e c t=”s ta tu s ”/>216 </ f o : l i s t −block>217 </ x s l : i f>218219 < x s l : i f t e s t=”count ( u r l ) &gt ; 0 ”>220 < f o : i n l i n e font−weight=”bold ”>Url ( s ) :</ f o : i n l i n e>221 < f o : l i s t −block margin− l e f t=”30pt ”>222 <xs l : app ly−templates s e l e c t=”u r l ”/>223 </ f o : l i s t −block>224 </ x s l : i f>225226 < x s l : i f t e s t=”count ( v e rd i c t ) &gt ; 0 ”>227 < f o : i n l i n e font−weight=”bold ”>Verd i c t s ( s ) :</ f o : i n l i n e>228 < f o : l i s t −block margin− l e f t=”30pt ”>229 <xs l : app ly−templates s e l e c t=”ve rd i c t ”/>230 </ f o : l i s t −block>231 </ x s l : i f>232233 < x s l : i f t e s t=”count ( ve r s i on ) &gt ; 0 ”>234 < f o : i n l i n e font−weight=”bold ”>Ver s i on :</ f o : i n l i n e>235 < f o : l i s t −block margin− l e f t=”30pt ”>236 <xs l : app ly−templates s e l e c t=”ve r s i on ”/>237 </ f o : l i s t −block>238 </ x s l : i f>239240 < x s l : i f t e s t=”count (member) &gt ; 0 ”>241 < f o : i n l i n e font−weight=”bold ”>Member( s ) :</ f o : i n l i n e>

59

Page 64: Bachelorarbeit Documentation Generation for TTCN-3 filefor automatic documentation generation from TTCN-3 source code using a standardized ... Softwaredokumentation ist ein wichtiger

7 Annex

242 < f o : l i s t −block margin− l e f t=”30pt ”>243 <xs l : app ly−templates s e l e c t=”member”/>244 </ f o : l i s t −block>245 </ x s l : i f>246247 < x s l : i f t e s t=”count ( c on f i g ) &gt ; 0 ”>248 < f o : i n l i n e font−weight=”bold ”>Conf i g :</ f o : i n l i n e>249 < f o : l i s t −block margin− l e f t=”30pt ”>250 <xs l : app ly−templates s e l e c t=”con f i g ”/>251 </ f o : l i s t −block>252 </ x s l : i f>253254 < x s l : i f t e s t=”count ( except ion ) &gt ; 0 ”>255 < f o : i n l i n e font−weight=”bold ”>Exception ( s ) :</ f o : i n l i n e>256 < f o : l i s t −block margin− l e f t=”30pt ”>257 <xs l : app ly−templates s e l e c t=”except ion ”/>258 </ f o : l i s t −block>259 </ x s l : i f>260261 < x s l : i f t e s t=”count ( purpose ) &gt ; 0 ”>262 < f o : i n l i n e font−weight=”bold ”>Purpose :</ f o : i n l i n e>263 < f o : l i s t −block margin− l e f t=”30pt ”>264 <xs l : app ly−templates s e l e c t=”purpose ”/>265 </ f o : l i s t −block>266 </ x s l : i f>267268 < x s l : i f t e s t=”count ( s i n c e ) &gt ; 0 ”>269 < f o : i n l i n e font−weight=”bold ”>S i n c e :</ f o : i n l i n e>270 < f o : l i s t −block margin− l e f t=”30pt ”>271 <xs l : app ly−templates s e l e c t=”s i n c e ”/>272 </ f o : l i s t −block>273 </ x s l : i f>274275 < x s l : i f t e s t=”count ( s ee ) &gt ; 0 ”>276 < f o : i n l i n e font−weight=”bold ”>See :</ f o : i n l i n e>277 < f o : l i s t −block margin− l e f t=”30pt ”>278 <xs l : app ly−templates s e l e c t=”see ”/>279 </ f o : l i s t −block>280 </ x s l : i f>281282 </ f o : b l o c k>283284 </ x s l : t emp l a t e>285286 <x s l : t emp l a t e match=”desc ”>287 < f o : b l o c k>288 <xs l : app ly−templates />289 </ f o : b l o c k>290 </ x s l : t emp l a t e>

60

Page 65: Bachelorarbeit Documentation Generation for TTCN-3 filefor automatic documentation generation from TTCN-3 source code using a standardized ... Softwaredokumentation ist ein wichtiger

7 Annex

291292 <x s l : t emp l a t e match=”text ”>293 <xs l : copy−o f s e l e c t=”text ( ) ”/>294 </ x s l : t emp l a t e>295296297 <x s l : t emp l a t e match=”esee ”>298 <xs l : copy−o f s e l e c t=”text ( ) ”/>299 <xs l : copy−o f s e l e c t=” ’ ’ ”/>300 </ x s l : t emp l a t e>301302 <x s l : t emp l a t e match=”see ”>303 < f o : l i s t −item>304 < f o : l i s t −item−l a b e l>305 < f o : b l o c k></ f o : b l o c k>306 </ f o : l i s t −item−l a b e l>307 < f o : l i s t −item−body>308 < f o : b l o c k><xs l : copy−o f s e l e c t=”text ( ) ”/></ f o : b l o c k>309 </ f o : l i s t −item−body>310 </ f o : l i s t −item>311 </ x s l : t emp l a t e>312313 <x s l : t emp l a t e match=”author | re turn | remark | param | s i n c e | s t a tu s |314 u r l | v e rd i c t | ve r s i on | member | c on f i g | except ion | purpose | s i n c e ”>315 < f o : l i s t −item>316 < f o : l i s t −item−l a b e l>317 < f o : b l o c k></ f o : b l o c k>318 </ f o : l i s t −item−l a b e l>319 < f o : l i s t −item−body>320 < f o : b l o c k><xs l : app ly−templates /></ f o : b l o c k>321 </ f o : l i s t −item−body>322 </ f o : l i s t −item>323 </ x s l : t emp l a t e>324325 </ x s l : s t y l e s h e e t>

Listing 7.3: The XSL Stylesheet (XSL-FO)

61