473,799 Members | 3,832 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

XSL Recursive nested elements woe

Hi every-one,

I'm rather new to this, so I'll just jump in.

I have an XML file that looks like this:

_______________ ______________X ML_____________ _______________ _____

<root>
<nextlevel>
<init>
<element1>
Content
</element1>
<element2>
More content
</element2>
...etc
<message>
<element1>
Content
</element1>
<element2>
More content
</element2>
...etc
<message>
<element1>
Content
</element1>
<element2>
More content
</element2>
...etc
</message>
</message>
</init>
</nextlevel>
</root>

_______________ _______________ _______________ _______________ _____

The <message> nodes may well contain other <message> nodes which could
contain other <message> nodes etc. etc. ad infinitum(well, almost!)

My problem is that when it comes to the XSL, I want to nest these nodes
and indent them and this is what I have so far:

_______________ ______________X SL_____________ _______________ _____
<xsl:template match="/">
<html>
<body>
<xsl:apply-templates/>
</body>
</html>
</xsl:template>

<xsl:template match="init">
<xsl:value-of select="element 1"/>
<xsl:value-of select="element 2"/><br />
</xsl:template>

<xsl:template name ="message" match="message" >
<blockquote>
<xsl:value-of select="element 1"/>
<xsl:value-of select="element 2"/>
<xsl:for-each select="message[count(descendan t::message)!='0 ']">
<xsl:call-template name="message"/>
</xsl:for-each>
</blockquote>
</xsl:template>

_______________ _______________ _______________ _______________ _____

However, this only nests up to and including the second <message> node
and no further. Any help appreciated :)

Tom.
Jul 20 '05 #1
0 1536

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

Similar topics

19
2297
by: Carlos Ribeiro | last post by:
Hello all, Here I am using some deeply nested, tree-like data structures. In some situations I need to traverse the tree; the old-style way to do it is to write a recursive method on the node class, as in: def walk(self): """old-style recursive tree traversal""" child.do_something for child in childs:
2
4271
by: rankam | last post by:
Hi There, We have a requirement for recursive elements within a XML document? Is it possible to design it through XML Schema? And what are implications using recursive elements when using DOM Parser in Java? Any samples demonstrating this concept in XSD is helpful? I need a XML structure something like this below : <forms>
2
5301
by: LoserInYourFaceEngineer | last post by:
Hello All: I'm having trouble with a recursive function. The function is supposed to identify nested folders in a hierarchical folder structure. The function "searchForFolders()" is supposed to traverse sibling nodes in each iteration, and for each sibling node, it calls itself again, to see if there are child nodes of the current sibling.
6
1670
by: Phil | last post by:
Hello I'm trying to display all DIV tags of a document : Example : + <DIV id="1"> - <DIV id="1-1"></DIV> </DIV> + <DIV id="2"> - <DIV id="2-1"></DIV>
4
9271
by: Rodusa | last post by:
I am having problem to apply updates into this function below. I tried using cursor for updates, etc. but no success. Sql server keeps telling me that I cannot execute insert or update from inside a function and it gives me an option that I could write an extended stored procedure, but I don't have a clue of how to do it. To quickly fix the problem the only solution left in my case is to convert this recursive function into one recursive...
25
2832
by: Mike MacSween | last post by:
Regular viewers may want to turn off now. This will be an orchestral management system. Musicians and other staff being booked/paid for jobs. A job may contain other jobs, e.g: World Tour contains US leg and Europe leg (and others) US leg contains State tours (and others)
2
7597
by: alexandre_irrthum | last post by:
Hello, I'd like to apply a function to elements of a nested list and wondered if there is anything more idiomatic and/or shorter than this recursive way: >>> def recur_map(f, data): .... if isinstance(data, list): .... mapped_list = .... for i in data:
2
11268
by: Gentr1 | last post by:
Hi everybody! I am presently working on a Genetic Programming API in python. I have a bit of a problem at the moment... For some specific reasons, I am using nested lists data structure to represent a tree. The first element of a list is always the head of the node, while all others represent the tail of the node. e.g. the nested list , E], ] represent the following tree: http://www.csd.abdn.ac.uk/~mkhoury/tree.jpg I need to be able...
10
7177
beacon
by: beacon | last post by:
Hi everybody, This is probably going to sound unorthodox, but I have to log records that are deleted...I know, go figure. Anyway, I have a form with a (continuous) subform, and on the subform I have a command button, called cmdDelete, that launches a dialog form, called frmDeleteCurrentRecord, where the user has to enter their name and a reason. I have managed, through a ton of trial and tribulation, found a way to delete the current...
31
6687
by: matthewslyman | last post by:
I have an unusual design and some very unusual issues with my code... I have forced Access to cooperate on everything except one issue - record deletion. My form design involves a recursively nested form. In other words, the form, m_settings_menueditor_recursive has a single subform; m_settings_menueditor_recursive (both are viewed as datasheets - so the form is its own subdatasheet.) The Form_Open event modifies the form's recordset so...
0
9687
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
10488
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...
0
9077
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7567
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
6808
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5467
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
5588
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3761
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2941
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.