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]
Sent: Tuesday, October 21, 2008 12:16 PM
To: [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'/>

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]
For additional commands, e-mail: [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]

   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"/>

<xsl:key
   name="tagdefinition"
   match="//UML:TagDefinition"
   use="@name"/>


<!-- Document Root -->
<xsl:template match="/">
   <xsl:apply-templates select="//UML:[EMAIL PROTECTED]" mode="body"/>
<!-- Classes -->
   <xsl:apply-templates select="//UML:[EMAIL PROTECTED]">
       <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" />
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" />

   <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]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to