Emil Karlen
Usenet Archive
- Joined
- Jul 9, 2004
- Messages
- 2
- Reaction score
- 0
I am modelling a software system in UML using Umbrello, which stores the UML-model in a XMI-file (which exact type I only guess).
Now, my goal is to: have a XSL-transformation (which I call the "script") that, given a name of a "Package"-element lists all "Interface"-, "Class"- and "Package"-elements underneath it. My problem is that I won't get the recursion running. The script only lists the elements directly underneath the package, not elements in subpackages. I have tried using "//" but it won't work.
I must have missunderstood something. I thought that this would match any class with the specified package as a parent (independent of depth):
"
<xsl:template match="UML
ackage[@name=$pkg]//UML:Class"> "
.... and that this would start the recursion:
"
<xsl:template match="UML
ackage[@name=$pkg]//UML
ackage"> ... <xsl:apply-templates/> </xsl:template> "
My own theory is that the "UML
ackage[@name=$pkg]//<elem>" uses the CLOSEST "UML
ackage"-element when matching, when I want it to mean ANY ancestor "UML
ackage"-element. But this is of course only my own theory.
Please help!
Thansks in advance,
Emil Karlén
Here is the whole "script":
"
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:UML="org.omg/standards/UML" xmlns="http://www.w3.org/TR/xhtml1/strict">
<xsl:template match="text"></xsl:template>
<xsl:template match="/">
<xsl:apply-templates select="/XMI/XMI.content/UML:Model"/> </xsl:template>
<xsl:template match="UML:Model">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="UML
ackage[@name=$pkg]//UML:Class"> Class<xsl:text> </xsl:text> <xsl:value-of select="@name"/> <xsl:text> </xsl:text> </xsl:template>
<xsl:template match="UML
ackage[@name=$pkg]//UML:Interface"> Interface <xsl:value-of select="@name"/> <xsl:text> </xsl:text> </xsl:template>
<xsl:template match="UML
ackage[@name=$pkg]//UML
ackage"> Package <xsl:value-of select="@name"/> <xsl:text> </xsl:text> <xsl:apply-templates/> </xsl:template>
</xsl:stylesheet>
"
Now, my goal is to: have a XSL-transformation (which I call the "script") that, given a name of a "Package"-element lists all "Interface"-, "Class"- and "Package"-elements underneath it. My problem is that I won't get the recursion running. The script only lists the elements directly underneath the package, not elements in subpackages. I have tried using "//" but it won't work.
I must have missunderstood something. I thought that this would match any class with the specified package as a parent (independent of depth):
"
<xsl:template match="UML
.... and that this would start the recursion:
"
<xsl:template match="UML
My own theory is that the "UML
Please help!
Thansks in advance,
Emil Karlén
Here is the whole "script":
"
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:UML="org.omg/standards/UML" xmlns="http://www.w3.org/TR/xhtml1/strict">
<xsl:template match="text"></xsl:template>
<xsl:template match="/">
<xsl:apply-templates select="/XMI/XMI.content/UML:Model"/> </xsl:template>
<xsl:template match="UML:Model">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="UML
<xsl:template match="UML
<xsl:template match="UML
</xsl:stylesheet>
"