Apply Templates on Nested XML

Discussion in 'XML' started by parksch2@hotmail.com, Feb 10, 2005.

  1. Guest

    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!
    , Feb 10, 2005
    #1
    1. Advertising

  2. Joris Gillis Guest

    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-view.cgi?userid=38041)
    Vincit omnia simplicitas
    Keep it simple
    Joris Gillis, Feb 10, 2005
    #2
    1. Advertising

  3. Guest

    Thnaks Joris! I had tried that earlier but I'm sure I messed it up
    somehow...
    , Feb 10, 2005
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Stefan Siegl
    Replies:
    1
    Views:
    949
    Marrow
    Jul 18, 2003
  2. Cyrille \cns\ Szymanski

    xsl apply-templates select=not(...)

    Cyrille \cns\ Szymanski, Nov 7, 2003, in forum: XML
    Replies:
    4
    Views:
    589
    Cyrille \cns\ Szymanski
    Nov 11, 2003
  3. JKop
    Replies:
    3
    Views:
    451
  4. recover
    Replies:
    2
    Views:
    785
    recover
    Jul 25, 2006
  5. Ultrus
    Replies:
    3
    Views:
    361
    Stefan Behnel
    Jul 9, 2007
Loading...

Share This Page