473,503 Members | 2,082 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How process all nodes within a specified parent?

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:Package[@name=$pkg]//UML:Class">
"

.... and that this would start the recursion:

"
<xsl:template match="UML:Package[@name=$pkg]//UML:Package">
...
<xsl:apply-templates/>
</xsl:template>
"

My own theory is that the "UML:Package[@name=$pkg]//<elem>" uses the
CLOSEST "UML:Package"-element when matching, when I want it to mean ANY
ancestor "UML:Package"-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:Package[@name=$pkg]//UML:Class">
Class<xsl:text> </xsl:text>
<xsl:value-of select="@name"/>
<xsl:text> </xsl:text>
<xsl:value-of select="@xmi.id"/>
</xsl:template>
<xsl:template match="UML:Package[@name=$pkg]//UML:Interface">
Interface <xsl:value-of select="@name"/>
<xsl:text> </xsl:text>
<xsl:value-of select="@xmi.id"/>
</xsl:template>
<xsl:template match="UML:Package[@name=$pkg]//UML:Package">
Package <xsl:value-of select="@name"/>
<xsl:text> </xsl:text>
<xsl:value-of select="@xmi.id"/>
<xsl:apply-templates/>
</xsl:template>

</xsl:stylesheet>
"

Jul 20 '05 #1
0 1409

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
6797
by: Mike M | last post by:
Is it possible? In the parent process, I have a socket that binds, listens and then accepts new connections (which creates new sockets in the process). I want to be able to pass some of these new...
2
7938
by: Claudio Jolowicz | last post by:
How can XSLT stylesheets be used to edit, remove and add nodes specified by their position in the document tree? The XML document stores development tasks in a hierarchical way, i.e. tasks can...
8
1517
by: Xamle Eng | last post by:
One of the things I find most unnatural about most XML APIs is that they try to abstract both elements and text into some kind of "node" object when they have virtually nothing in common. The...
2
10662
by: Greg | last post by:
Hi. I have a rather large xml document (object) that can have one or more nodes with a certain attribute throughout (at ANY depth, not at the same level necessarily). I need to find this...
8
2623
by: Mikey | last post by:
I have an XML document as follows: <Menu> <Group> <Item Text="About Us" AccessRoles="All"> <Group> <Item Text="Option 1" AccessRoles="All" /> <Item Text="Option 2" AccessRoles="All" /> <Item...
3
2951
by: felixfix | last post by:
Hi all, I am just wondering if something is wrong with my program. What it bascially does is to output a fibonacci sequence base on the command-line output. If I give a 5, it will generate the...
6
14162
by: kk | last post by:
hello to all, I want to call an exe file on other system(on the same LAN)though a webservice(by placing the dll).For that i use the following code in C#...... Process ps = new Process();...
1
1531
by: jdhcards | last post by:
Hello, I've been banging my head against a problem all day without a solution, and I'm hoping you all can help. I've got a piece of XML that defines a set of elements in a flat list. Each of...
4
3007
by: reflex | last post by:
I have to get every node within range or selection? Is it possible? Sry for my engrish :] Ref
0
7205
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7287
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7353
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7011
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
3180
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3170
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1521
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
747
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
401
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.