473,385 Members | 2,162 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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:

_____________________________XML__________________ _______________

<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:

_____________________________XSL__________________ _______________
<xsl:template match="/">
<html>
<body>
<xsl:apply-templates/>
</body>
</html>
</xsl:template>

<xsl:template match="init">
<xsl:value-of select="element1"/>
<xsl:value-of select="element2"/><br />
</xsl:template>

<xsl:template name ="message" match="message">
<blockquote>
<xsl:value-of select="element1"/>
<xsl:value-of select="element2"/>
<xsl:for-each select="message[count(descendant::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 1516

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

Similar topics

19
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...
2
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...
2
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...
6
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
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...
25
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...
2
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...
2
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...
10
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...
31
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...

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.