473,385 Members | 1,661 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.

Apply Templates on Nested XML

Quick question:

How would I nest the apply templates on the following XML structure?

/ITEM/CHILD/ITEM/CHILD/ITEM/CHILD

I would first like to apply templates on /ITEM/CHILD. Within that
template, I would like to apply a template on ITEM/CHILD (the children
of the first ITEM/CHILD). Then within the second level template, I
would again like to apply a template on its children (the grandchildren
of the first ITEM/CHILD). The problem is that the output differs in
each template, but the names are the same so my match statements are
the same. I'm sure there is an easy way to do this but I can't seem to
find it. Any ideas? Thanks in advance!

Jul 20 '05 #1
2 1892
Tempore 18:26:05, die Thursday 10 February 2005 AD, hinc in foro {comp.text.xml} scripsit <pa******@hotmail.com>:
Quick question:

How would I nest the apply templates on the following XML structure?

/ITEM/CHILD/ITEM/CHILD/ITEM/CHILD

I would first like to apply templates on /ITEM/CHILD. Within that
template, I would like to apply a template on ITEM/CHILD (the children
of the first ITEM/CHILD). Then within the second level template, I
would again like to apply a template on its children (the grandchildren
of the first ITEM/CHILD). The problem is that the output differs in
each template, but the names are the same so my match statements are
the same. I'm sure there is an easy way to do this but I can't seem to
find it. Any ideas? Thanks in advance!

Hi,

Quick answer: use the 'mode' attribute:

e.g.
<xsl:apply-templates select="ITEM/CHILD" mode="level2"/>
regards,
--
Joris Gillis (http://www.ticalc.org/cgi-bin/acct-v...i?userid=38041)
Vincit omnia simplicitas
Keep it simple
Jul 20 '05 #2
Thnaks Joris! I had tried that earlier but I'm sure I messed it up
somehow...

Jul 20 '05 #3

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

Similar topics

8
by: Torsten Curdt | last post by:
template<class TYPE, class ELEMENT> class MyClass : public TYPE<ELEMENT,ELEMENT> { }; This does not seem to work - but why? -- Torsten
1
by: Stefan Siegl | last post by:
Hello, I am trying to learn XSLT to use it in another project. I start reading the book "Java and XSLT" and tried the examples and they are went quite fine (how suprising *g*). Then I tried...
1
by: Daryl | last post by:
Hello I am using apply-templates and would like to pass a parameter to the template using with-param. Using call-template passes the parameter, but when I use apply-templates, the parameter seems...
5
by: david hepworth | last post by:
Hi All I will try to explain my problem. I am wishing to apply a template to the following XML. There are multiple event nodes within the register root node. For each of the event nodes there...
3
by: bjam | last post by:
Help! The apply-templates function is not currently allowing me to select a specific template... eventhough I tried putting a select statement, it does not seem to work??? Can someone help show...
3
by: Blaise Garant | last post by:
Hi I've made a stylesheet to transform my data into XSL-FO. This stylesheet used to work with MSXSL 4.0 but I've got some issues in ..NET. First, I changed removed all the "node-set()" function...
2
by: jimbo_vr5 | last post by:
Hey I think i've figured out the idea behind apply-templates. But going through the tutorial on <http://www.w3schools.com/xsl/xsl_apply_templates.asp> theres simply just something that i dont...
3
by: abhishek.smu | last post by:
Given an XML like: <root> <node>8</node> <node>21</node> <node>-7</node> <node>13</node> <node>43</node> <node>2</node> </root>
104
by: JohnQ | last post by:
Well apparently not since one can step thru template code with a debugger. But if I was willing to make the concession on debugging, templates would be strictly a precompiler thing? I have a...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.