Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > Apply Templates on Nested XML

Reply
Thread Tools

Apply Templates on Nested XML

 
 
parksch2@hotmail.com
Guest
Posts: n/a
 
      02-10-2005
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!

 
Reply With Quote
 
 
 
 
Joris Gillis
Guest
Posts: n/a
 
      02-10-2005
Tempore 18:26:05, die Thursday 10 February 2005 AD, hinc in foro {comp.text.xml} scripsit <>:

> 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
 
Reply With Quote
 
 
 
 
parksch2@hotmail.com
Guest
Posts: n/a
 
      02-10-2005
Thnaks Joris! I had tried that earlier but I'm sure I messed it up
somehow...

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
dealing with nested xml within nested xml within...... Ultrus Python 3 07-09-2007 09:00 PM
how to Specializations of function Templates or Overloading Function templates with Templates ? recover C++ 2 07-25-2006 02:55 AM
Templates templates templates JKop C++ 3 07-21-2004 11:44 AM
xsl apply-templates select=not(...) Cyrille \cns\ Szymanski XML 4 11-11-2003 04:38 PM
[XSLT] could not apply "apply-templates" Stefan Siegl XML 1 07-18-2003 09:43 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57