Personal tools
You are here: Home Tools STAR STAR document transformations

STAR document transformations

The primary transformation of a STAR document is into XML. Consider the following STAR example:

 :Schema:
 VerySimpleFlow.sss

 :Flow of events:
 1. The use case begins when the Customer actor accesses the first page of the website.
 2. The system automatically recognises the Customer.
 3. The system automatically logs the Customer on to the site.

This is transformed by the application STARToXMLRenderer.py into:

 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <?xml-stylesheet href="VerySimpleFlow.xsl" type="text/xml"?>
 <VerySimpleFlow>
  <Flow_of_events>
     <line>1. The actor selects "add item".</line>
     <line>2. The system asks for the ItemDetails.</line>
     <line>3. The actor enters the ItemDetails.</line>
     <line>4. The system adds the the new LibraryItem to the open catalog.</line>
  </Flow_of_events>
 </VerySimpleFlow>

There are a several points to note:

  • The schema name becomes the root tag of the XML document
  • Any spaces in the tag names are replaced by underscores
  • STAR automatically references an XSL stylesheet called SchemaName.xsl

STARToXMLRenderer.py renders all STAR documents in a target directory into XML files. It creates a subdirectory /xml/ for these files. You can run the program from the command line as follows:

 python STARToXMLRenderer.py -o G:\PythonPrograms\SUMR4\ECPUseCaseModel\*.uc

This command transforms all files with extension .uc into XML files in the subdirectory G:\PythonPrograms\SUMR4\ECPUseCaseModel\xml

STARToXMLRenderer.py uses a very simple deafult mapping:

  :Tag name: -> <Tag_name> ... </Tag_name>
  a line -> <line>a line </line>

Inline tags are currently not mapped, but we will correct this in a future release of the tools.

An identical feature is integrated into the STAR Use Case Editor application for your convenience.

Complete example

We will now look at a complete example for the use case AddLibraryItemToCatalog.uc.

Here is the use case AddLibraryItemToCatalog in STAR format:

 :Schema:
 UseCase.sss

 :Name:
 AddLibraryItemToCatalog

 :ID:
 U001

 :Parent use cases:
 None

 :Primary actors:
 Librarian
 HeadLibrarian

 :Secondary actors:
 None

 :Brief description:
 The actor adds a new LibraryItem to the open catalog.

 :Preconditions:
 1. The actor is logged on to OLAS.
 2. The actor has opened a catalog to work on.

 :Flow of events:
 1. The actor selects "add item".
 2. The system asks for the LibraryItemDetails.
 3. The actor enters the LibraryItemDetails.
 4. The system adds the the new LibraryItem to the open catalog.

 :Postconditions:
 1. A new LibraryItem has been added to the open catalog.

 :Alternative flows:
 1. AddLibraryItemToCatalog.Cancel
 2. AddLibraryItemToCatalog.IdentifierExists

 :Requirements:
 To do.

This is transformed by STARToXMLRenderer.py into AddItemToBasket.xml:

 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <?xml-stylesheet href="UseCase.xsl" type="text/xml"?>
 <UseCase>
   <Schema>
     <line>UseCase.sss</line>
   </Schema>
   <Name>
     <line>AddLibraryItemToCatalog</line>
   </Name>
   <ID>
     <line>U001</line>
   </ID>
   <Parent_use_cases>
     <line>None</line>
   </Parent_use_cases>
   <Primary_actors>
     <line>Librarian</line>
     <line>HeadLibrarian</line>
   </Primary_actors>
   <Secondary_actors>
     <line>None</line>
   </Secondary_actors>
   <Brief_description>
     <line>The actor adds a new LibraryItem to the open catalog.</line>
   </Brief_description>
   <Preconditions>
     <line>1. The actor is logged on to OLAS.</line>
     <line>2. The actor has opened a catalog to work on.</line>
   </Preconditions>
   <Flow_of_events>
     <line>1. The actor selects "add item".</line>
     <line>2. The system asks for the ItemDetails.</line>
     <line>3. The actor enters the ItemDetails.</line>
     <line>4. The system adds the the new LibraryItem to the open catalog.</line>
   </Flow_of_events>
   <Postconditions>
     <line>1. A new LibraryItem has been added to the open catalog.</line>
   </Postconditions>
   <Alternative_flows>
     <line>1. Cancel</line>
     <line>2. IdentifierExists</line>
   </Alternative_flows>
   <Requirements>
     <line>To do.</line>
   </Requirements>
 </UseCase>

Transforming XML with XSL stylesheets

STAR uses XSL stylesheets to transform XML renderings of STAR documents to other formats. We will shortly provide stylesheet generators to generate default XSL stylesheets from STAR schema. This gets you started very quickly, and with just a little XSL knowledge, and you can customize these generated stylesheets to give your output documents the look and feel that you want.

As an example of the sort of transformations possible, here is a simple XSLT stylesheet for use cases: UseCase.xsl

You can use xalan to perform apply the stylesheet as follows:

 xalan -IN AddLibraryItemToCatalog.xml -XSL UseCase.xsl -OUT AddLibraryItemToCatalog.html

This generates the HTML file AddLibraryItemToCatalog.html which uses the CSS stylesheet UseCase.css for styling.

Document Actions
Log in


Forgot your password?
« July 2010 »
July
MoTuWeThFrSaSu
1234
567891011
12131415161718
19202122232425
262728293031