Re: Newbie: Generating a class dictionary from a class diagram?

Leif Holmgren <[email protected]> Fri, 24 Oct 2008 17:38:28 +0200
Newsgroups gmane.comp.lang.uml.argouml.user
Message-ID <[email protected]>
Neither I could let this rest.

I could not find a way to include the profile xmi file into the 
processing directly. Instead I managed to do a preprocessing of the file 
so that given the two files you get a merge files where the id 
references have been corrected. I attach it.

When you run this you need to supply the name of the profile file as a 
parameter. With saxon that is done by typing
java -jar d:\prog\saxon\saxon8.jar test.xmi preprocess.xsl 
profile=default-uml14.xmi > intermediate.xmi
My guess is that with xsltproc the command line would be
xsltproc test.xmi preprocess.xsl profile=default-uml14.xmi > 
intermediate.xmi

Then you can run your transformation into documentation successfully.

I notice that saxon reports two warnings so it's not 100% sure that it 
will work

/Leif


Hayrol Reyes wrote:

> Well guys, I worked yesterday in the learning XMI and XSLT a little 
> more and after I dedicated the today morning to modify xmi-to-html.xsl 
> in order to extract the documentation from clases. I got some small 
> progress (unfortunately), but at least my xmi-to-html2.xsl could 
> transform some field from the Documentation tab of my .zargo (of 
> course exported first to xmi) into the html result.
>  
> Kevin, because the main problem is that some UML:TagDefinition has its 
> xmi.id <http://xmi.id> outside the source xmi (using href to 
> default-uml14.xmi, as is the case of "documentation" field) then you 
> need to use the tagged values that has its xmi.id <http://xmi.id> 
> inside the source xmi, I mean, the author, version and see fields from 
> the Documentation tab are tagged values fully identifiable becouse its 
> xmi.id <http://xmi.id> still into the source xmi. So, you can use the 
> "see" field as documentation container, anyway it's like the 
> "documentation" field but xslt accessible for novices like me. I have 
> updated the original xmi-to-html.xsl into my own xml-to-html2.xsl with 
> the necesary changes for the class documentation (using the "see" 
> field, again). I did can't write this xslt code as dynamic as I 
> wanted, so I wrote the code fixed for each field (a really bad 
> approach), but it's my first try with xslt, so I hope to learn a 
> little more and make it better (for sure, it could be better written).
>  
> Btw, there are also a problem  with the xls:key for 
> //UML:TagDefinition, in the file I downloaded (xmi-to-html-xsl), so 
> I'm attaching my xmi-to-html2.xls with this correction and the 
> documentation generation part.
>  
> Hope this help you a little more.
>  
> Regards,
>  
> PS: I'm attaching the other files I used too.
> 2008/10/22 Leif Holmgren <[email protected] <mailto:[email protected]>>
>
>     I can't help you with the reference issues. I tried to look at it
>     yesterday but I have no clue how to solve this in xslt. I hope you
>     get some input from the dev list.
>
>     You should also add a
>     <xsl:output method="text"/>
>     element to your stylesheet. Just before the first <xsl:key element
>     will be find. That will remove any XML or HTML output that is not
>     directly in your code.
>
>     Good luck.
>
>     /Leif
>
>     Zembower, Kevin wrote:
>
>         Leif, thanks for your continued advice.
>
>         At least one problem with the link you pointed out is that I
>         get this response if I just try to bring in up in a browser:
>          Access is denied. Error processing resource
>          'http://argouml.org/profiles/uml14/default-uml14.xmi'.
>         Can anyone fix this?
>
>         In case anyone is playing along at home, I've attached my
>         crude hack of just cutting out the parts I don't need from
>         xmi-to-html.xsl, called xmi-to-ClassDictionary.xsl. I use it with:
>          xsltproc xmi-to-ClassDictionary.xsl test.xmi >test.txt
>         using the same text.xmi from my previous post and examine
>         test.txt with less. This is a much smaller file that
>         xmi-to-html.xmi, and may be easier to work with. It's working,
>         but the definitions don't show up. This is what I'm working on
>         now.
>
>         Thanks, again. If I get this working, I'll post it in the file
>         download section of ArgoUML.
>
>         -Kevin
>
>         -----Original Message-----
>         From: Leif Holmgren [mailto:[email protected]
>         <mailto:[email protected]>]
>         Sent: Tuesday, October 21, 2008 12:16 PM
>         To: [email protected] <mailto:[email protected]>
>         Subject: Re: [argouml-users] Newbie: Generating a class
>         dictionary from a class diagram?
>
>         Zembower, Kevin wrote:
>
>          
>
>             I down loaded the documents from the link you provided,
>             Leif, and got some preliminary results. Before I go crazy
>             changing things, I tried to use these files without
>             modification to generate output. I used this command to
>             generate an html file:
>             xsltproc xmi-to-html.xsl test.xmi > test.html
>             When I examine test.html with lynx, a text-only browser, I
>             see my two classes, Test and NotTest. However, I don't see
>             the documentation notes in each of these classes. Should I?
>
>              
>
>         Well, there seem to be a problem somewhere. This is a bit over
>         my head
>         as I am primarily a modeller but:
>         Documentation is placed in the XMI-file as a tagged value on the
>         modelling element it belongs to. Tagged values have their tag name
>         placed in a tag definition. It seems as if these are no longer
>         output to
>         the XMI files from ArgoUML. Instead it refers to a profile-file.
>         <UML:TagDefinition href =
>         'http://argouml.org/profiles/uml14/default-uml14.xmi#.:000000000000087C'/
>         <http://argouml.org/profiles/uml14/default-uml14.xmi#.:000000000000087C%27/>>
>
>         I don't know how to fix this. Probably you could find the
>         profile file
>         somewhere in the project CM system. Perhaps even at the
>         specified path,
>         but that is really only an id so don't expect to find it there.
>         When you find it you could probably somehow merge the XMI
>         files but
>         remember that XML only supports one root elemet per file so
>         the profile
>         should have to go into the other file.
>
>          
>
>             Note that I had to manually insert this second line:
>                <!DOCTYPE XMI SYSTEM "UML14.dtd">
>             UML14.dtd from this page:
>
>              
>
>         Must be something specific to xsltproc. Never had to do that
>         but I use
>         saxon.
>
>          
>
>             I'm hoping someone has the patience to give me some
>             suggestions on modifying xmi-to-html.xsl to just produce
>             plain text output of class names and documentation.
>
>
>              
>
>         It's not that difficult. Generating plain text instead of  XML
>         (or HTML
>         for that matter) is fully possible. I use XSLT to generate
>         Delphi code
>         from my models. Just find the tags that look like HTML and
>         eliminate
>         these, or replace them with plain text headers, linebreaks or
>         whatever
>         you want. Leave anything starting with <xsl: as that is what
>         defines
>         your template structure and queries on the XMI file. I'm sure
>         you will
>         find it easy when you start poking around in it. (By the way, )
>
>         /Leif
>
>
>         ---------------------------------------------------------------------
>         To unsubscribe, e-mail: [email protected]
>         <mailto:[email protected]>
>         For additional commands, e-mail: [email protected]
>         <mailto:[email protected]>
>
>          
>         ------------------------------------------------------------------------
>
>         <!--
>           Title: xmi-to-ClassDictionary.xsl
>           Purpose: An XSL stylesheet for converting ArgoUML 0.26 XMI
>         to a plain
>           text file of Class name and documentation.
>
>           Modified from xmi-to-html.xsl.
>
>           This program is free software; you can redistribute it
>         and/or modify
>           it under the terms of the GNU General Public License as
>         published by
>           the Free Software Foundation. A copy of the license may be
>         found at
>           http://www.objectsbydesign.com/projects/gpl.txt
>
>           Version:  21 October 2008
>           Author:   Kevin Zembower, [email protected]
>         <mailto:[email protected]>
>
>           For HISTORY and CREDITS, please see the README file.
>
>         -->
>
>         <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>                       xmlns="http://www.w3.org/1999/xhtml"
>                       xmlns:UML="org.omg.xmi.namespace.UML"
>                       version="1.0"
>                       exclude-result-prefixes="#default">
>                       <xsl:key
>           name="classifier"
>           match="//UML:Class|//UML:Interface|
>                  //UML:DataType"
>           use="@xmi.id <http://xmi.id/>"/>
>
>         <xsl:key
>           name="tagdefinition"
>           match="//UML:TagDefinition"
>           use="@name"/>
>
>
>         <!-- Document Root -->
>         <xsl:template match="/">
>           <xsl:apply-templates select="//UML:Model[@xmi.id
>         <http://xmi.id/>]" mode="body"/>
>                   <!-- Classes -->
>           <xsl:apply-templates select="//UML:Class[@xmi.id
>         <http://xmi.id/>]">
>               <xsl:sort select="@name"/>
>           </xsl:apply-templates>
>
>         </xsl:template>
>
>
>         <!-- Document Heading -->
>         <xsl:template match="UML:Model" mode="body">
>                  <!-- Name of the model -->
>               <xsl:value-of select="@name"/>
>
>         </xsl:template>
>
>
>         <!-- Class -->
>         <xsl:template match="UML:Class">
>           <xsl:variable name="element_name"        select="@name"/>
>
>           <xsl:variable name="xmi_id" select="@xmi.id <http://xmi.id/>" />
>           Class: <xsl:value-of select="$element_name"/>
>                <xsl:call-template name="documentation"/>
>         </xsl:template>
>
>         <xsl:template name="documentation">
>           <xsl:variable name="doctag"
>                select="key('tagdefinition', 'documentation')/@xmi.id
>         <http://xmi.id/>" />
>
>           <xsl:variable name="documentation"
>               select="UML:ModelElement.taggedValue/UML:TaggedValue
>                                        
>         [UML:TaggedValue.type/UML:TagDefinition/@xmi.idref=$doctag]/
>                                         UML:TaggedValue.dataValue"/>
>           <xsl:if test="string-length($documentation)>0">
>         Working Definition (Documentation): <xsl:value-of
>         select="$documentation"/>
>           </xsl:if>
>         </xsl:template>
>
>         </xsl:stylesheet>
>          
>         ------------------------------------------------------------------------
>
>
>
>         ---------------------------------------------------------------------
>         To unsubscribe, e-mail: [email protected]
>         <mailto:[email protected]>
>         For additional commands, e-mail: [email protected]
>         <mailto:[email protected]>
>
>
>
>
>     ---------------------------------------------------------------------
>     To unsubscribe, e-mail: [email protected]
>     <mailto:[email protected]>
>     For additional commands, e-mail: [email protected]
>     <mailto:[email protected]>
>
>
>------------------------------------------------------------------------
>
><?xml version="1.0"?>
><!--
>    Title: xmi-to-html.xsl
>    Purpose: An XSL stylesheet for converting ArgoUML 0.80 XMI to HTML.
>
>    Copyright (C) 1999-2001, Objects by Design, Inc. All Rights Reserved.
>
>    This program is free software; you can redistribute it and/or modify
>    it under the terms of the GNU General Public License as published by
>    the Free Software Foundation. A copy of the license may be found at
>    http://www.objectsbydesign.com/projects/gpl.txt
>
>    Version:  March 5, 2006
>    
>    Hayrol Reyes
>    Version: October 23, 2008 (Just a test, not HISTORY and CREDITS updated in the README file)
>
>    For HISTORY and CREDITS, please see the README file.
>
>-->
>
><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>                xmlns="http://www.w3.org/1999/xhtml"
>                xmlns:UML="org.omg.xmi.namespace.UML"
>                version="1.0"
>                exclude-result-prefixes="#default">
>                
><xsl:output method="xml" indent="yes" 
>            doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
>            doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" />
>
><xsl:key
>    name="classifier"
>    match="//UML:Class|//UML:Interface|
>           //UML:DataType"
>    use="@xmi.id"/>
>
><xsl:key
>    name="generalization"
>    match="//UML:Generalization"
>    use="@xmi.id"/>
>
><xsl:key
>    name="abstraction"
>    match="//UML:Abstraction"
>    use="@xmi.id"/>
>
><xsl:key
>    name="multiplicity"
>    match="//UML:Multiplicity"
>    use="@xmi.id"/>
>
><xsl:key
>    name="tagdefinition"
>    match="//UML:TagDefinition"
>    use="@name"/>
>
>
><!-- Document Root -->
><xsl:template match="/">
>    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
>    <head>
>    <!-- Model Name in window title -->
>    <xsl:apply-templates select="//UML:Model[@xmi.id]" mode="head"/>
>
>    <link href="xmi.css" rel="stylesheet" type="text/css"/>
>    </head>
>    <body>
>   
>    <!-- Model Name in document heading -->
>    <xsl:apply-templates select="//UML:Model[@xmi.id]" mode="body"/>
>         
>    <!-- Interfaces -->
>    <xsl:apply-templates select="//UML:Interface[@xmi.id]">
>        <xsl:sort select="@name"/>
>    </xsl:apply-templates>
>
>    <!-- Classes -->
>    <xsl:apply-templates select="//UML:Class[@xmi.id]">
>        <xsl:sort select="@name"/>
>    </xsl:apply-templates>
>
>    </body>
>    </html>
>
></xsl:template>
>
>
><!-- Window Title -->
><xsl:template match="UML:Model" mode="head">
>    
>    <title>
>	<!-- Name of the model -->
>        <xsl:value-of select="@name"/>
>    </title>
>
></xsl:template>
>
>
><!-- Document Heading -->
><xsl:template match="UML:Model" mode="body">
>    
>    <div align="center">
>    <h1>
>	<!-- Name of the model -->
>        <xsl:value-of select="@name"/>
>    </h1>
>    </div>
>
></xsl:template>
>
>
><!-- Class -->
><xsl:template match="UML:Class">
>    <xsl:variable name="element_name" 
>         select="@name"/>
>
>    <xsl:variable name="xmi_id" select="@xmi.id" />
>    
>    <div align="center">
>    <table border="1" width="75%" cellpadding="2" >
>    <tr>
>        <td class="class-title" width="20%">Class</td>
>
>        <!-- create a hyperlink target for the name -->
>        <td class="class-name">
>            <a name="{$element_name}">
>                <xsl:value-of select="$element_name"/>
>            </a>
>        </td>
>    </tr>
>
>    <tr>
>    <td colspan="2" >
>    <table width="100%" cellpadding="0" cellspacing="0" border="0">
>    <tr>
>        <td colspan="2" bgcolor="#cacaca">
>        <table width="100%" border="0" cellpadding="3" cellspacing="1">
>
>
>        <xsl:call-template name="specifications"/>
>
>        <xsl:call-template name="realizations"/>
>
>        <xsl:call-template name="supertypes"/>
>        
>        <xsl:call-template name="subtypes"/>
>        
>        <xsl:call-template name="associations">
>            <xsl:with-param name="source" select="$xmi_id"/>
>        </xsl:call-template>
>        
>        <xsl:call-template name="attributes"/>
>
>        <xsl:call-template name="operations"/>
>
>        <xsl:call-template name="documentationtest"/>
>
>	  <xsl:call-template name="documentation"/>
>
>        </table>
>        </td>
>    </tr>
>
>    </table>
>    </td>
>    </tr>
>
>    </table>
>    </div>
>    <br /><br />
></xsl:template>
>
>
><!-- Interface -->
><xsl:template match="UML:Interface">
>    <xsl:variable name="element_name" 
>         select="@name"/>
>
>    <div align="center">
>    <table border="1" width="75%" cellpadding="2" >
>    <tr>
>        <td class="interface-title" width="20%">Interface</td>
>
>        <!-- create a hyperlink target for the name -->
>        <td class="interface-name">
>            <a name="{$element_name}">
>                <xsl:value-of select="$element_name"/>
>            </a>
>        </td>
>    </tr>
>
>    <tr>
>    <td colspan="2" >
>    <table width="100%" cellpadding="0" cellspacing="0" border="0">
>
>    <tr>
>        <td colspan="2" bgcolor="#cacaca">
>        <table width="100%" border="0" cellpadding="3" cellspacing="1">
>
>        <xsl:call-template name="realizations"/>
>
>        <xsl:call-template name="supertypes"/>
>        
>        <xsl:call-template name="subtypes"/>
>
>        <xsl:call-template name="operations"/>
>
>        </table>
>        </td>
>    </tr>
>
>    </table>
>    </td>
>    </tr>
>
>    </table>
>    </div>
>    <br/><br/>
></xsl:template>
>
>
><!-- The following template is designed to be called for Abstractions with the "realize"
>     stereotype, i.e. Realization relationships.  It formats the name of the supplier of the
>     Abstraction dependency, i.e. the class or interface specifying the behaviour of the
>     client in the dependency.
>-->
><!-- Specifications (interface or class) -->
><xsl:template name="specifications">
>
>    <!-- Abstractions identify specifications -->
>    <xsl:variable name="specifications" 
>         select="UML:ModelElement.clientDependency/
>                 UML:Abstraction"/>
>
>    <xsl:if test="count($specifications) > 0">
>        <tr>
>            <td width="20%" class="info-title">Specifications:</td>
>            <td colspan="2" class="info">
>            <xsl:for-each select="$specifications">
>            
>                <!-- get the supplier in the abstraction -->
>                <xsl:variable name="abstraction"
>                     select="key('abstraction', ./@xmi.idref)" />
>                <xsl:variable name="target"
>                     select="$abstraction/
>                            UML:Dependency.supplier/
>                            */@xmi.idref" /> 
>
>                <xsl:call-template name="classify">
>                    <xsl:with-param name="target" select="$target"/>
>                </xsl:call-template>
>                
>                <xsl:if test="position() != last()">
>                    <xsl:text>,  </xsl:text>
>                </xsl:if>
>            </xsl:for-each>
>            </td>
>        </tr>
>    </xsl:if>  
>        
></xsl:template>
>
>
><!-- The following template is designed to be called for Abstractions with the "realize"
>     stereotype, i.e. Realization relationships.  It formats the name of the client of the
>     Abstraction dependency, i.e. the class realizing the specification defined by the
>     supplier in the dependency.
>-->
><!-- Realizations (of interface) -->
><xsl:template name="realizations">
>
>    <xsl:variable name="classid" select="@xmi.id"/>
>
>    <!-- Abstractions identify realizations -->
>    <xsl:variable name="realizations" 
>         select="//UML:Abstraction[UML:Dependency.supplier/*/@xmi.idref=$classid]"/>
>
>    <xsl:if test="count($realizations) > 0">
>        <tr>
>            <td width="20%" class="info-title">Realizations:</td>
>            <td colspan="2" class="info">
>            <xsl:for-each select="$realizations">
>            
>                <!-- get the client in the abstraction -->
>                <xsl:variable name="target"
>                     select="UML:Dependency.client/
>                            */@xmi.idref" /> 
>                <xsl:call-template name="classify">
>                    <xsl:with-param name="target" select="$target"/>
>                </xsl:call-template>
>                
>                <xsl:if test="position() != last()">
>                    <xsl:text>,  </xsl:text>
>                </xsl:if>
>            </xsl:for-each>
>            </td>
>        </tr>
>    </xsl:if>  
>        
></xsl:template>
>
>
>
><!-- Supertypes (inheritance) -->
><xsl:template name="supertypes">
>    
>    <!-- Generalizations identify supertypes -->
>    <xsl:variable name="generalizations" 
>         select="UML:GeneralizableElement.generalization/
>                 UML:Generalization"/>
>
>    <xsl:if test="count($generalizations) > 0">
>        <tr>
>            <td width="20%" class="info-title">Supertypes:</td>
>            <td colspan="2" class="info">
>            <xsl:for-each select="$generalizations">
>            
>                <!-- get the parent in the generalization -->
>                <xsl:variable name="generalization"
>                     select="key('generalization', ./@xmi.idref)" />
>                <xsl:variable name="target"
>                     select="$generalization/
>                            UML:Generalization.parent/
>                            */@xmi.idref" /> 
>                <xsl:call-template name="classify">
>                    <xsl:with-param name="target" select="$target"/>
>                </xsl:call-template>
>                
>                <xsl:if test="position() != last()">
>                    <xsl:text>,  </xsl:text>
>                </xsl:if>
>            </xsl:for-each>
>            </td>
>        </tr>
>    </xsl:if>  
></xsl:template>
>
>
><!-- Subtypes (inheritance) -->
><xsl:template name="subtypes">
>
>    <xsl:variable name="classid" select="@xmi.id"/>
>
>    <!-- Specializations identify subtypes -->
>    <xsl:variable name="specializations" 
>         select="//UML:Generalization[UML:Generalization.parent/UML:Class/@xmi.idref=$classid]"/>
>
>    <xsl:if test="count($specializations) > 0">
>        <tr>
>            <td width="20%" class="info-title">Subtypes:</td>
>            <td colspan="2" class="info">
>            <xsl:for-each select="$specializations">
>            
>                <!-- get the child in the generalization -->
>                <xsl:variable name="target"
>                     select="UML:Generalization.child/
>                            */@xmi.idref" /> 
>                <xsl:call-template name="classify">
>                    <xsl:with-param name="target" select="$target"/>
>                </xsl:call-template>
>                
>                <xsl:if test="position() != last()">
>                    <xsl:text>,  </xsl:text>
>                </xsl:if>
>            </xsl:for-each>
>            </td>
>        </tr>
>    </xsl:if>  
></xsl:template>
>
>
><!-- Associations -->
><xsl:template name="associations">
>    <xsl:param name="source"/>
>    
>    <xsl:variable name="association_ends" 
>         select="//UML:AssociationEnd
>                 [UML:AssociationEnd.participant/*/
>                  @xmi.idref=$source]" />
>
>    <xsl:if test="count($association_ends) > 0">
>        <tr>
>            <td colspan="3" class="info-title">Associations:</td>
>        </tr>
>        <tr>
>            <td class="feature-heading" width="20%">visibility</td>
>            <td class="feature-heading" width="25%">type</td>
>            <td class="feature-heading" width="55%">properties</td>
>        </tr>
>
>        <xsl:for-each select="$association_ends">
>        <tr>
>            <xsl:for-each select="preceding-sibling::UML:AssociationEnd |
>                                  following-sibling::UML:AssociationEnd">
>
>                <xsl:call-template name="association_end" />
>            
>            </xsl:for-each>
>        </tr>
>        </xsl:for-each>
>    </xsl:if>  
></xsl:template>
>
>
><!-- Association End -->
><xsl:template name="association_end">
>    <!-- Visibility -->
>    <td class="feature-detail">
>        <xsl:variable name="visibility"
>             select="@visibility" />
>        <xsl:choose>
>            <xsl:when test="string-length($visibility) > 0">
>                <xsl:value-of select="$visibility"/>
>            </xsl:when>
>            <xsl:otherwise>
>                <xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
>            </xsl:otherwise>
>        </xsl:choose>        
>    </td>
>    
>    <!-- Type -->
>    <td class="feature-detail">
>        <xsl:variable name="target"
>             select="UML:AssociationEnd.participant/*/@xmi.idref" />
>
>        <xsl:call-template name="classify">
>            <xsl:with-param name="target" select="$target"/>
>        </xsl:call-template>
>    </td>
>    
>    <!-- Properties -->
>    <td class="feature-detail">
>    
>        <!-- Rolename -->
>        <xsl:variable name="rolename" 
>             select="@name"/>
>                      
>        <span class="property-name">Rolename: </span>
>        <xsl:choose>
>            <xsl:when test="string-length($rolename) > 0">
>                <xsl:value-of select="$rolename"/>
>            </xsl:when>
>            <xsl:otherwise>(none)</xsl:otherwise>
>        </xsl:choose>
>        
>        <!-- Multiplicity -->
>        <xsl:apply-templates select=".//UML:Multiplicity" />
>    
>        <!-- Navigable -->
>        <xsl:variable name="navigable" 
>             select="@isNavigable"/>
>        <xsl:if test="string-length($navigable) > 0">
>            <br />
>            <span class="property-name">Navigable: </span>
>            <xsl:value-of select="$navigable"/>
>        </xsl:if>
>        
>        <!-- Ordering -->
>        <xsl:variable name="ordering" 
>             select="@ordering"/>
>        <xsl:if test="string-length($ordering) > 0">
>            <br />
>            <span class="property-name">Ordering: </span>
>            <xsl:value-of select="$ordering"/>
>        </xsl:if>
>    </td>
></xsl:template>
>
>
><!-- Multiplicity (definition) -->
><xsl:template match="UML:Multiplicity[@xmi.id]">
>    <br />
>    <span class="property-name">Multiplicity: </span>
>    
>    <xsl:variable name="lower" 
>         select=".//@lower"/>
>	 
>    <xsl:variable name="upper" 
>         select=".//@upper"/>
>
>    <xsl:value-of select="$lower" />
>    <xsl:if test="$upper != $lower">
>        <xsl:text>..</xsl:text>
>	<xsl:if test="$upper!='-1'">
>        	<xsl:value-of select="$upper" />
>	</xsl:if>
>	<xsl:if test="$upper='-1'">*</xsl:if>
>    </xsl:if>
>    
></xsl:template>
>
><!-- Multiplicity (reference) -->
><xsl:template match="UML:Multiplicity[@xmi.idref]">
>    <xsl:apply-templates
>        select="key('multiplicity', @xmi.idref)" />
></xsl:template>
>
>
>
><!-- Attributes -->
><xsl:template name="attributes">
>    <tr>
>        <td colspan="3" class="info-title">Attributes:</td>
>    </tr>
>    <xsl:choose>
>        <xsl:when test="count(UML:Classifier.feature/UML:Attribute) > 0">
>            <tr>
>                <td class="feature-heading" width="20%">visibility</td>
>                <td class="feature-heading" width="25%">type</td>
>                <td class="feature-heading" width="55%">name</td>
>            </tr>
>            <xsl:apply-templates select="UML:Classifier.feature/UML:Attribute" />
>        </xsl:when>
>        <xsl:otherwise>
>            <tr>
>                <td colspan="3" class="feature-detail">
>                    none
>                </td>
>            </tr>
>        </xsl:otherwise>
>    </xsl:choose>
></xsl:template>
>
>
><xsl:template match="UML:Attribute">
>    <xsl:variable name="target"
>         select='UML:StructuralFeature.type/*/@xmi.idref'/>
>
>
>    <tr>
>        <td class="feature-detail">
>        <xsl:value-of select="@visibility"/>
>        </td>
>
>        <td class="feature-detail">
>        <xsl:call-template name="classify">
>            <xsl:with-param name="target" select="$target" />
>        </xsl:call-template>
>        </td>
>
>        <td class="feature-detail">
>        <xsl:value-of select="@name"/>
>        </td>
>    </tr>
></xsl:template>
>
>
>
><!-- Operations -->
><xsl:template name="operations">
>    <tr>
>        <td colspan="3" class="info-title">Operations:</td>
>    </tr>
>    <xsl:choose>
>        <xsl:when test="count(UML:Classifier.feature/UML:Operation) > 0">
>            <tr>
>                <td class="feature-heading" width="20%">visibility</td>
>                <td class="feature-heading" width="25%">return</td>
>                <td class="feature-heading" width="55%">name</td>
>            </tr>
>
>            <xsl:apply-templates select="UML:Classifier.feature/
>                                         UML:Operation" />
>        </xsl:when>
>        <xsl:otherwise>
>            <tr>
>                <td colspan="3" class="feature-detail">
>                    none
>                </td>
>            </tr>
>        </xsl:otherwise>
>    </xsl:choose>
></xsl:template>
>
>
><xsl:template match="UML:Operation">
>    <xsl:variable name="parameters"
>         select="UML:BehavioralFeature.parameter/
>         UML:Parameter
>	 [@name!='return']" />
>	 
>    <xsl:variable name="return"
>         select="UML:BehavioralFeature.parameter/
>         UML:Parameter
>	 [@kind='return']" />
>		  
>    <xsl:variable name="target"
>         select="$return/UML:Parameter.type/*/@xmi.idref" />
>
>    <tr>
>        <td class="feature-detail">
>            <xsl:value-of select="@visibility" />
>        </td>
>
>        <td class="feature-detail">
>
>        <xsl:choose>
>            <xsl:when test="string-length($target) = 0">
>                <span class="datatype"><xsl:text>void</xsl:text></span>
>            </xsl:when>
>
>            <xsl:otherwise>
>                <xsl:call-template name="classify">
>                    <xsl:with-param name="target" select="$target" />
>                </xsl:call-template>
>            </xsl:otherwise>
>        </xsl:choose>
>
>        </td>
>
>        <td class="feature-detail">
>            <xsl:value-of select="@name"/>
>        </td>
>    </tr>
>
>    <xsl:variable name="parameter-count" select="count($parameters)" />
>
>    <xsl:if test="not(normalize-space($parameter-count)='0')">
>
>    <tr>
>        <td class="feature-detail" >
>            <xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
>        </td>
>        
>        <td class="parameter-heading" valign="top">parameters:</td>
>        <td bgcolor="#ffffff" align="right">
>            <table width="85%" align="right" cellpadding="0" cellspacing="0" border="0">
>                <xsl:apply-templates select="$parameters" />
>            </table>
>        </td>
>    </tr>
>
>    </xsl:if >
>
></xsl:template>
>
>
>
><!-- Parameter -->
><xsl:template match="UML:Parameter">
>    <xsl:variable name="target" 
>         select="UML:Parameter.type/*/@xmi.idref" />
>
>    <tr>
>        <td class="feature-detail" width="45%">
>            <xsl:call-template name="classify">
>                <xsl:with-param name="target" select="$target" />
>            </xsl:call-template>
>        </td>
>
>        <td class="feature-detail" width="55%">
>            <xsl:value-of select="@name"/>
>        </td>
>    </tr>
></xsl:template>
>
>
><!-- Classification -->
><xsl:template name="classify">
>    <xsl:param name="target"/>
>
>    <xsl:variable name="classifier"
>         select="key('classifier', $target)" />
>                  
>    <xsl:variable name="classifier_name"
>         select="$classifier/@name" />
>
>    <xsl:variable name="type" select="name($classifier)" />
>
>    <!-- Get the type of the classifier (class, interface, datatype) -->
>    <xsl:variable name="classifier_type">
>    <xsl:choose>
>        <xsl:when test="$type='UML:Class'">classifier</xsl:when>
>        <xsl:when test="$type='UML:Interface'">interface</xsl:when>
>        <xsl:when test="$type='UML:DataType'">datatype</xsl:when>
>        <xsl:otherwise>classifier</xsl:otherwise>
>    </xsl:choose>
>    </xsl:variable>
>    
>    <xsl:choose>
>        <!-- Datatypes don't have hyperlinks -->
>        <xsl:when test="$type='UML:DataType'">
>            <span class="datatype">
>                <xsl:value-of select="$classifier_name"/>
>            </span>
>        </xsl:when>
>        
>        <!-- Classes and Interfaces have hyperlinks -->
>        <!-- The classifier type is used to style appropriately -->
>        <xsl:otherwise>
>            <xsl:if test="string-length($classifier_name) > 0">
>                <a class="{$classifier_type}" href="#{$classifier_name}">
>                <xsl:value-of select="$classifier_name"/>
>                </a>
>            </xsl:if>
>        </xsl:otherwise>
>    </xsl:choose>
>
></xsl:template>
>
><xsl:template name="documentation">
>    <xsl:variable name="doctag"
>	select="key('tagdefinition', 'documentation')/@xmi.id" />
>
>    <xsl:variable name="documentation"
>        select="UML:ModelElement.taggedValue/UML:TaggedValue
>                                  [UML:TaggedValue.type/UML:TagDefinition/@xmi.idref=$doctag]/
>                                  UML:TaggedValue.dataValue"/>
>    <xsl:if test="string-length($documentation)>0">
>        <tr>
>            <td colspan="3" class="info-title">Documentation:</td>
>        </tr>
>        <tr>
>            <td colspan="3" class="feature-detail">
>                <xsl:value-of select="$documentation"/>
>            </td>
>        </tr>
>    </xsl:if>
></xsl:template>
>
><xsl:template name="documentationtest">
>    <xsl:variable name="author"
>	select="key('tagdefinition', 'author')/@xmi.id" />
>
>    <xsl:variable name="classauthor"
>        select="UML:ModelElement.taggedValue/UML:TaggedValue
>                                  [UML:TaggedValue.type/UML:TagDefinition/@xmi.idref=$author]/
>                                  UML:TaggedValue.dataValue"/>
>    <xsl:variable name="version"
>	select="key('tagdefinition', 'version')/@xmi.id" />
>
>    <xsl:variable name="classversion"
>        select="UML:ModelElement.taggedValue/UML:TaggedValue
>                                  [UML:TaggedValue.type/UML:TagDefinition/@xmi.idref=$version]/
>                                  UML:TaggedValue.dataValue"/>
>    <xsl:variable name="see"
>	select="key('tagdefinition', 'see')/@xmi.id" />
>
>    <xsl:variable name="classsee"
>        select="UML:ModelElement.taggedValue/UML:TaggedValue
>                                  [UML:TaggedValue.type/UML:TagDefinition/@xmi.idref=$see]/
>                                  UML:TaggedValue.dataValue"/>
>    <tr>
>        <td colspan="3" class="info-title">Documentation:</td>
>    </tr>
>    <xsl:if test="string-length($classauthor)>0">
>        <tr>
>		<td class="feature-heading" width="20%">author:</td>
>            <td colspan="3" class="feature-detail">
>                <xsl:value-of select="$classauthor"/>
>            </td>
>        </tr>
>    </xsl:if>
>    <xsl:if test="string-length($classversion)>0">
>        <tr>
>		<td class="feature-heading" width="20%">version:</td>
>            <td colspan="3" class="feature-detail">
>                <xsl:value-of select="$classversion"/>
>            </td>
>        </tr>
>    </xsl:if>
>    <xsl:if test="string-length($classsee)>0">
>        <tr>
>		<td class="feature-heading" width="20%">description:</td>
>            <td colspan="3" class="feature-detail">
>                <xsl:value-of select="$classsee"/>
>            </td>
>        </tr>
>    </xsl:if>
></xsl:template>
>
></xsl:stylesheet>
>
>
> ------------------------------------------------------------------------
>
>
>   pruebabeta
>
> Class Hito
> Supertypes: Tarea <#Tarea>
> Attributes:
> visibility type name
> public
> startDate
> Operations:
> visibility return name
> public void Hito
> Documentation:
> author: Hayro Reyes
> version: 0.01
> description: Clase especializada, hereda desde Tarea
>
>
>
> Class Manager
> Associations:
> visibility type properties
> public Proyecto <#Proyecto> Rolename: (none)
> Multiplicity: 1
> Navigable: false
> Ordering: unordered
> public Tarea <#Tarea> Rolename: (none)
> Multiplicity: 1
> Navigable: false
> Ordering: unordered
> Attributes:
> visibility type name
> private Manager <#Manager> manager
> Operations:
> visibility return name
> public Proyecto <#Proyecto> obtenerProyectoPorId
>   parameters:
>
> idProyecto
>
> public Tarea <#Tarea> obtenerTareaPorId
>   parameters:
>
> idProyecto
>
> idTarea
>
> private void Manager
> Documentation:
> author: Hayrol Reyes
> version: 0.01
> description: Clase de utileria, utiliza el patrón Singleton.
>
>
>
> Class Proyecto
> Associations:
> visibility type properties
> public Tarea <#Tarea> Rolename: (none)
> Multiplicity: 1..*
> Navigable: true
> Ordering: unordered
> public Manager <#Manager> Rolename: (none)
> Multiplicity: 1
> Navigable: false
> Ordering: unordered
> Attributes:
> visibility type name
> public
> idProyecto
> public
> nombreProyecto
> private
> fechaInicio
> Operations:
> visibility return name
> public void Proyecto
> Documentation:
> author: Hayrol Reyes
> version: 0.01
> description: Clase primaria.
>
>
>
> Class Tarea
> Subtypes: Hito <#Hito>
> Associations:
> visibility type properties
> public Proyecto <#Proyecto> Rolename: (none)
> Multiplicity: 1
> Navigable: true
> Ordering: unordered
> public Manager <#Manager> Rolename: (none)
> Multiplicity: 1
> Navigable: false
> Ordering: unordered
> Attributes:
> visibility type name
> public
> idTarea
> public
> nombreTarea
> Operations:
> visibility return name
> public void Tarea
> Documentation:
> author: Hayrol Reyes
> version: 0.01
> description: Clase Primaria.
>
>
>
>------------------------------------------------------------------------
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [email protected]
>For additional commands, e-mail: [email protected]
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
preprocess.xsl (text/xml, 762 B)
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:param name="profile"/>
	<xsl:output method="xml" indent="no" encoding="ISO-8859-1"/>
	
	<xsl:template match="/">
		<xsl:apply-templates select="XMI"/>
	</xsl:template>

	<xsl:template match="XMI">
		<XMI>
			<xsl:copy-of select="document($profile)"/>
			<xsl:apply-templates select="@*|node()"/>

		</XMI>
	</xsl:template>

	<xsl:template match="@*|node()">
		<xsl:copy>
			<xsl:apply-templates select="@*"/>
			<xsl:apply-templates/>
		</xsl:copy>
	</xsl:template>

	<xsl:template match="@href">
		<xsl:attribute name="xmi.idref">
			<xsl:value-of select="substring-after(.,'#')"/>
		</xsl:attribute>
	</xsl:template>
</xsl:stylesheet>