Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Topcased Requirements Table XSLT
<?xml version="1.0" encoding="UTF-8"?>
* Copyright (c) 2009 RealTime-at-Work.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* Contributors:
* Loïc Fejoz - initial transformation.
<xsl:stylesheet version="1.0" xmlns:xsl="" xmlns:xmi="" xmlns:sysML="" xmlns:uml="" xmlns:fn="">
<xsl:output method="html" version="1.0" indent="yes"/>
<xsl:template match="/uml:Model">
<title>table [requirement] <xsl:value-of select='@name'/> [all requirements]</title>
<link rel="stylesheet" type="text/css" href="style.css" />
<div class='model package'>
<h1><xsl:value-of select='@name'/></h1>
<xsl:apply-templates select='packagedElement[@xmi:type="uml:Package"]'>
<xsl:with-param name="depth" select="2" />
<xsl:template match="packagedElement[@xmi:type='uml:Package']">
<xsl:param name="depth" />
<xsl:if test='count(descendant::*[@xmi:type="sysML:Requirement"]) &gt; 0'>
<div class='package'>
<xsl:attribute name="id">
<xsl:value-of select="@xmi:id" />
<xsl:element name="{concat('h', string($depth))}">
<xsl:value-of select='@name'/>
<xsl:if test='count(child::*[@xmi:type="sysML:Requirement"]) &gt; 0'>
<table class='requirement-table' border='1'>
<xsl:apply-templates select='descendant::*[@xmi:type="sysML:Requirement"]'>
<xsl:sort select='@id'/>
<xsl:apply-templates select='packagedElement[@xmi:type="uml:Package"]'>
<xsl:with-param name="depth" select="$depth + 1" />
<xsl:template match='*[@xmi:type="sysML:Requirement"]'>
<tr class='requirement'>
<xsl:attribute name="id">
<xsl:value-of select="@xmi:id" />
<td><xsl:value-of select="@id" /></td>
<td><xsl:value-of select="@name" /></td>
<td><xsl:value-of select="@text" /></td>

This comment has been minimized.

Copy link
Owner Author

kwharrigan commented May 28, 2010

From here:

TopCased is a widely used and free SysML editor. Our SysML-Companion can work with it. Unfortunately TopCased is still lacking table notation (see feature request #2157), especially for requirements.

Here is a simple XSL stylesheet (EPL-1.0) that creates an HTML file containing the tables from the XMI file written with TopCased SysML editor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.