473,806 Members | 2,795 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1911
Tempore 18:26:05, die Thursday 10 February 2005 AD, hinc in foro {comp.text.xml} scripsit <pa******@hotma il.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
3318
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
2815
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 to adopt these examples to my files. Unfortunately I did not work even though the styleSheet is very simple. Perhaps you can help me with it.
1
2717
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 to be lost. Can parameters be passed with apply-templates? Any ideas? <!--xml--> <?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="tran2.xsl"?> <doc>
5
1871
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 are a list of students taking the Event. I wish to apply a template (and thus get the data) for the same student across the events. I can apply the template to student 18 for event 1, how do i then get the data for student 18 from event 2 and...
3
1660
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 how I can select the first template and then have it select others? Below is a sample of the xml as well as the .xsl file when I do something like the following in the main section it does not seem to work, it only works when I remove the select...
3
3151
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 since they're not used anymore. But now, I used an <xsl:apply-templates/> and for some reason, it works in some situation but not in others. I didn't put the whole XSL file since it's quite big. Here's the part that bugs
2
1659
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 get! In the following i've copy pasted the example from <http://www.w3schools.com/xsl/xsl_apply_templates.asp> into this post. I divide into sections and my real question will come after the code snippet:
3
2793
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
4624
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 feeling the answer I'm going to get back will be "no, because templates have taken on a life of their own since their original conception and now also affect compiler implementation" (read: not good, IMO. John
0
9599
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10371
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10111
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
7650
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
5546
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
5684
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4330
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 we have to send another system
2
3853
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3010
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.