Apply Templates on Nested XML

P

parksch2

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!
 
J

Joris Gillis

Tempore 18:26:05 said:
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,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top