473,796 Members | 2,515 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:Pack age[@name=$pkg]//UML:Class">
"

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

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

My own theory is that the "UML:Packag e[@name=$pkg]//<elem>" uses the
CLOSEST "UML:Packag e"-element when matching, when I want it to mean ANY
ancestor "UML:Packag e"-element.
But this is of course only my own theory.

Please help!
Thansks in advance,
Emil Karlén
Here is the whole "script":

"
<xsl:styleshe et 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:Mode l">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="UML:Pack age[@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:Pack age[@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:Pack age[@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 1421

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

Similar topics

11
6871
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 sockets to a spawned process. Is it possible, and if so how? Any help is much appreciated!! Mike
2
7972
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 have subtasks, subsubtasks, etc. It has the following form: <todo> <note>Task 1</note> <note> Task 2
8
1546
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 reason these APIs do it is to make it possible for both text and elements to be children of elements. But there is another way. The XPath/XQuery data model does not allow two consecutive text nodes. As far as I can tell, most XML processing...
2
10703
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 attribute and remove the containing node (and child nodes) if it has a certain value. I'm able to find the attributes using an XmlTextReader. Once found, can someone help me get the XPath at that point? I would then use this to remove the node from...
8
2643
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 Text="Option 3" AccessRoles="All" /> </Group>
3
2965
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 first 5 fibonacci number. The problem is, I thought the parent process will always go first, and so here I should get "0, 1, 1, 2, 3" But I ran the program, it will give me "1, 2, 3, 0, 1", which is, the child process ran first. Is there any way...
6
14204
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(); ps.StartInfo.FileName = exeFilePath ps.StartInfo.Arguments = arguments; ps.Start();
1
1550
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 these elements has an attribute "Id" which has a unique value. Some of these elements have a parent-child relationship, specified with a "ResultId" attribute in one of the child nodes. <element id=1>
4
3028
by: reflex | last post by:
I have to get every node within range or selection? Is it possible? Sry for my engrish :] Ref
0
9683
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10457
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10176
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10013
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7550
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5443
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5576
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3733
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2927
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.