[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] Retrieving information from a rational rose 2000e XMI file.


Subject: [xsl] Retrieving information from a rational rose 2000e XMI file.
From: "Lionel, trollhunter Bouchpan-Lerust-Juery" <l.bouchpan@xxxxxxxxxxxxx>
Date: Wed, 24 Mar 2004 11:16:01 +0100

Hello,

I am a newcomer to XSLT and I am trying to retrieve various information
from a rational rose 2000e XMI file using the xsltproc from the libxslt
library.

The problem is that I can't get started: I have a hard time with namespaces
and the like. I can't extract the information I am looking for in the XMI
file.

I have read many tutorials on the Internet and tried to adapt the proposed
solutions but without results.

What I try to extract from the XMI file are the informations about the
various packages, their classes, the classes attributes and methods.
As you can see it is more XSLT 101 than rocket science.

Included the xsltproc detailed information, the "hello world" stylesheet
I am using and parts of the XMI file.

Can someone helps me getting started ?

Best regards
 Lionel

------------- xsltproc detailed information ---------------------------

Using libxml 20423, libxslt 10019 and libexslt 710
xsltproc was compiled against libxml 20422, libxslt 10019 and libexslt 710
libxslt 10019 was compiled against libxml 20422
libexslt 710 was compiled against libxml 20422


--------- stylesheet derived from http://www.dstc.edu.au/ListArchive/mof/archive/2001/10/msg00059.html ---


<?xml version='1.0'?>
<xsl:stylesheet
   xmlns:Model='omg.org.mof.Model'
   xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
   xmlns='http://www.w3.org/1999/xhtml'
   xml:default-space='strip'
   version='1.0'>

<xsl:output method='xml'
   version='1.0'
   doctype-public='-//W3C//DTD XHTML 1.0 Strict//EN'
   doctype-system='http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'
   indent='yes'
/>

<xsl:template match="/">
   <html>
     <head><title>Class in packages </title></head>
     <body><xsl:apply-templates/></body>
   </html>
</xsl:template>

<xsl:template match="Model:Package">
   <ul>
     <xsl:for-each select="Class">
       <xsl:sort select="@name"/>
       <li><xsl:value-of select="@name"/>
           <xsl:apply-templates/>
       </li>
     </xsl:for-each>
   </ul>
</xsl:template>


<xsl:template match="text() | @*"/>


</xsl:stylesheet>


------------------- parts of the Rational rose 2000e XMI file ----------------------


<?xml version = '1.0' encoding = 'ISO-8859-1' ?>
<!-- <!DOCTYPE XMI SYSTEM 'Model1311.DTD' > -->
<XMI xmi.version = '1.1' xmlns:Model='http://omg.org/mof.Model/1.3' timestamp = 'Thu Feb 26 15:59:28 2004' >
<XMI.header>
<XMI.documentation>
<XMI.exporter>Unisys.JCR.1</XMI.exporter>
<XMI.exporterVersion>1.3.4</XMI.exporterVersion>
</XMI.documentation>
<XMI.metamodel xmi.name = 'org.omg.mof.Model' xmi.version = '1.3'/>
</XMI.header>
<XMI.content>
<!-- ==================== Architecture [Package] ==================== -->
<Model:Package xmi.id = 'a403E097000D7'
name = 'Architecture' annotation = ''
isRoot = 'false' isLeaf = 'false' isAbstract = 'false' visibility = 'public_vis' >
<Model:Namespace.contents>
<!-- ==================== Architecture.TransportBaseComponents [Package] ==================== -->
<Model:Package xmi.id = 'a4030E76A01AE'
name = 'TransportBaseComponents'
isRoot = 'false' isLeaf = 'false' isAbstract = 'false' visibility = 'public_vis' >
<Model:ModelElement.annotation>The base components.
An adaptation of the SysML philosophy to Rational Rose 2000e</Model:ModelElement.annotation>
<Model:Namespace.contents>
<!-- ==================== Architecture.TransportBaseComponents.Magnetometer [Class] ==================== -->
<Model:Class xmi.id = 'a4032403A00EA'
name = 'Magnetometer' annotation = ''
isRoot = 'false' isLeaf = 'false' isAbstract = 'false' visibility = 'public_vis'
isSingleton = 'false'
supertypes = 'a402BA2C9036B' >
<Model:Namespace.contents>
<!-- ==================== Architecture.TransportBaseComponents.Magnetometer.roll [Attribute] ==================== -->
<Model:Attribute xmi.id = 'a403243B800B4'
name = 'roll' annotation = ''
scope = 'instance_level' visibility = 'public_vis'
isChangeable = 'true'
isDerived = 'false'
type = 'G.44' >
<Model:StructuralFeature.multiplicity>
<Model:MultiplicityType lower = '1' upper = '1' is_ordered = 'false' is_unique = 'false' />
</Model:StructuralFeature.multiplicity>
</Model:Attribute>
<!-- ==================== Architecture.TransportBaseComponents.Magnetometer.yaw [Attribute] ==================== -->
<Model:Attribute xmi.id = 'a403243FB004C'
name = 'yaw' annotation = ''
scope = 'instance_level' visibility = 'public_vis'
isChangeable = 'true'
isDerived = 'false'
type = 'G.44' >
<Model:StructuralFeature.multiplicity>
<Model:MultiplicityType lower = '1' upper = '1' is_ordered = 'false' is_unique = 'false' />
</Model:StructuralFeature.multiplicity>
</Model:Attribute>
<!-- ==================== Architecture.TransportBaseComponents.Magnetometer.pitch [Attribute] ==================== -->
<Model:Attribute xmi.id = 'a403244030057'
name = 'pitch' annotation = ''
scope = 'instance_level' visibility = 'public_vis'
isChangeable = 'true'
isDerived = 'false'
type = 'G.44' >
<Model:StructuralFeature.multiplicity>
<Model:MultiplicityType lower = '1' upper = '1' is_ordered = 'false' is_unique = 'false' />
</Model:StructuralFeature.multiplicity>
</Model:Attribute>
</Model:Namespace.contents>
</Model:Class>
<!-- ==================== Architecture.TransportBaseComponents.com.urep.jcr.transient=true [Tag] ==================== -->
<Model:Tag xmi.id = 'G.43'
name = 'com.urep.jcr.transient=true' annotation = ''
tagId = 'com.urep.jcr.transient'
elements = 'a4032403A00EA a402B8E400112 a402B8FFD0249 a402B9F8102A4 a402B9F7A036D a402B8FE002BF a402CD48F03AA a402B8FBF0073 a4\
02B923F0132 a402BA2D10272 a402BA2C9036B a402B9253002C a402B91480227 a402B926E00DF a402B927E036D a402CA92C0190 a402B8F6C00EC a402B94F103D\
3 a402B94FD01A9
a402B952601EE a402B90080371 a402B9C7E0129 a402B9BEC001B a402B9BE8006F a402B96C30238 a402B96BB0060 a402B96C9039F a402B9719010F a402B9BF10\
11C a402B9BFC0399 a402B9FD5034F a402B9FCA0227 a402BA2EE0241 a402BA2DF0145 a402BA2E601A0 a402BA2D90093 a402B954E00FB' >
<Model:Tag.values>
<XMI.any xmi.type = 'string' xmi.name = ''>true</XMI.any>
</Model:Tag.values>
</Model:Tag>
<!-- ==================== Architecture.TransportBaseComponents.Double [DataType] ==================== -->
<Model:DataType xmi.id = 'G.44'
name = 'Double' annotation = ''
isRoot = 'false' isLeaf = 'false' isA
<Model:DataType.typeCode>
<XMI.CorbaTypeCode>
<XMI.CorbaTcDouble/>
</XMI.CorbaTypeCode>
</Model:DataType.typeCode>
</Model:DataType>
<!-- ==================== Architecture.TransportBaseComponents.Component [Class] ==================== -->
<Model:Class xmi.id = 'a402B8E400112'
name = 'Component' annotation = ''
isRoot = 'false' isLeaf = 'false' isAbstract = 'false' visibility = 'public_vis'
isSingleton = 'false' >
<Model:Namespace.contents>
<!-- ==================== Architecture.TransportBaseComponents.Component.name [Attribute] ==================== -->
<Model:Attribute xmi.id = 'a402B8E5201FF'
name = 'name' annotation = 'The Component&apos;s name'
scope = 'instance_level' visibility = 'public_vis'
isChangeable = 'true'
isDerived = 'false'
type = 'G.45' >
<Model:StructuralFeature.multiplicity>
<Model:MultiplicityType lower = '1' upper = '1' is_ordered = 'false' is_unique = 'false' />



Current Thread
Keywords