Dear developers, I'm carrying this discussion over from the users list, in the 
hopes that you can help me with my task. I've copied in the thread from the 
users list below.

I'm using ArgoUML for my assignments in a class in Object Oriented Analysis and 
Design. One part of my term project is to turn in an alphabetical list of 
classes and their 'working definitions,' a Class Dictionary. (Generating the 
dictionary from ArgoUML isn't my term project assignment. I could 
satisfactorily turn in the dictionary as a word processed document.) I'm trying 
to get ArgoUML to help generate this by entering the working definitions in the 
'documentation' field for each class. I'm then trying to use an XLST processor 
to extract this information from the .xmi file.

I've attached these files to this message:
  ArgoUML class dictionary test.zargo  The whole ArgoUML test file
  xmi-to-ClassDictionary.xsl
  test.xmi The .xmi file extracted from the .zargo archive
  t.txt The output file

On my system, with both files in a local directory, I do:
  xsltproc xmi-to-ClassDictionary.xsl test.xmi >t.txt

(Tangent: I picked xsltproc before I knew about saxon. What would I type if I 
used saxon? Would it make any difference in the output?)

>From the output you can see that it finds the two classes okay, but can't find 
>their embedded documentation.

If anyone can give me any guidance on diagnosing or fixing this problem, I'd be 
grateful. Thank you in advance for your help and advice.

-Kevin

-----Original Message-----
From: Tom Morris [mailto:[EMAIL PROTECTED]
Sent: Tuesday, October 21, 2008 7:47 PM
To: [EMAIL PROTECTED]
Subject: Re: [argouml-users] Newbie: Generating a class dictionary from a class 
diagram?

I can't tell from your description what's not working here, but
unfortunately I don't really have time right now to do any significant
debugging.  Let me offer instead some random tidbits of
advice/observation.

The profile does seem to be available on the Tigris site.  I'm not
sure if someone fixed it since you reported the problem, but another
possibility is that you were using Internet Explorer.  I think it
gives some kind of "access denied" error by default when you try to
use it to open an XSL file.

For local testing the easiest thing to do is to put the profile XMI in
the same directory as your model and access it using a relative URI.

I'm not sure if XSLT works across multiple files, but I think it
should.  The HREFs are a standard XML mechanism, although I'm not 100%
sure the #anchor notation conforms to the standard XML definition.

We had intended to provide a mechanism to export a "flattened" version
of the XMI file with all external references resolved, but it never
got implemented.  That would be one sure cure for this particular
situation, but it should be possible to work with what we're exporting
now -- I just don't know how much work it is without digging into it.

Sorry I can't be of more help.

Tom


On Tue, Oct 21, 2008 at 3:59 PM, Zembower, Kevin <[EMAIL PROTECTED]> wrote:
> Well, I've taken it as far as I can and I'm stumped now. I copied the file 
> default-uml14.xmi to my server, and changed the file test.xmi with this perl 
> one-liner:
>  perl -i~ -pe 
> "s[http://argouml.org/profiles/uml14][http://www.jhuccp.org/temp/KZ]g"; 
> test.xmi
>
> I've attached the changed test.xmi and t.txt from:
>  xsltproc xmi-to-ClassDictionary.xsl test.xmi >t.txt
>
> I've also attached my xmi-to-ClassDictionary.xsl.
>
> Any suggestions or advice on tools to troubleshoot this problem would be 
> gratefully appreciated. I've tried running xsltproc with --dumpextensions, 
> --verbose and --debug, but wasn't helped by the output.
>
> -Kevin
>
> -----Original Message-----
> From: Zembower, Kevin [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, October 21, 2008 12:33 PM
> To: '[EMAIL PROTECTED]'
> Subject: RE: [argouml-users] Newbie: Generating a class dictionary from a 
> class diagram?
>
> 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]
>
>
> ---------------------------------------------------------------------
> 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]

<!--
    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.

    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>

<!-- Documentation (Working Definition) -->
<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:if test="string-length($documentation)=0">
Working Definition (Documentation): Doesn't exist yet.
    </xsl:if>
</xsl:template>

</xsl:stylesheet>

Attachment: ArgoUML class dictionary test.zargo
Description: ArgoUML class dictionary test.zargo

Attachment: test.xmi
Description: test.xmi

<?xml version="1.0"?>
untitledModel
    
Class: NotTest
Working Definition (Documentation): Doesn't exist yet.
    
    
Class: Test
Working Definition (Documentation): Doesn't exist yet.
    
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to