Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. XML / XSL
  4. Calling a template recursively??

Calling a template recursively??

Scheduled Pinned Locked Moved XML / XSL
xmltutorialquestion
22 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G George L Jackson

    xsl:call-template has is own "scope" as far as variable creation. But the scope of the current node and node-list is the same as its calling parent.

    "We make a living by what we get, we make a life by what we give." --Winston Churchill

    R Offline
    R Offline
    Rocky
    wrote on last edited by
    #13

    OK! can u tel me how can we get the parent node of the current node. I was thinking that while traversing through the $nodeset I shoujld chk for the existance of another CallSequence Node and the call the same template again recursively. Rocky You can't climb up a ladder with your hands in your pockets.

    G 1 Reply Last reply
    0
    • R Rocky

      OK! can u tel me how can we get the parent node of the current node. I was thinking that while traversing through the $nodeset I shoujld chk for the existance of another CallSequence Node and the call the same template again recursively. Rocky You can't climb up a ladder with your hands in your pockets.

      G Offline
      G Offline
      George L Jackson
      wrote on last edited by
      #14

      It can be "parent::node()" or "parent::*". I think you can specifically check if the parent has a specific name by using "parent::CallSequence"!

      "We make a living by what we get, we make a life by what we give." --Winston Churchill

      R 3 Replies Last reply
      0
      • G George L Jackson

        It can be "parent::node()" or "parent::*". I think you can specifically check if the parent has a specific name by using "parent::CallSequence"!

        "We make a living by what we get, we make a life by what we give." --Winston Churchill

        R Offline
        R Offline
        Rocky
        wrote on last edited by
        #15

        I was thinking abt starting a new articles on this but then I changed my mind again... I'm back to the recursive solution again bcz the previous one wasn't showing the right sequence and this recursive one gets a nodeset missed when it starts recursion. I'm giving the template I made and the XML I'm using. Here comes the Template! Recursive Solution

        Call to

        Object Type

        Object Name

        Interface Name

        Return Code

        Inputs

        1 Reply Last reply
        0
        • G George L Jackson

          It can be "parent::node()" or "parent::*". I think you can specifically check if the parent has a specific name by using "parent::CallSequence"!

          "We make a living by what we get, we make a life by what we give." --Winston Churchill

          R Offline
          R Offline
          Rocky
          wrote on last edited by
          #16

          I've found why this is missing the calling functions data As you can see this isthe basic model of recursion I'm using which was proposed by you previously. What happens is that that this condition in the choose-when actually doesnt consider whether there are some nodes above another CallSequence Clause. -------------- see this section of XML Unit ChemSepUO_382 ICapeUnit Calculate -------------- I've tried to change the conditions but its no help Rocky You can't climb up a ladder with your hands in your pockets.

          1 Reply Last reply
          0
          • G George L Jackson

            It can be "parent::node()" or "parent::*". I think you can specifically check if the parent has a specific name by using "parent::CallSequence"!

            "We make a living by what we get, we make a life by what we give." --Winston Churchill

            R Offline
            R Offline
            Rocky
            wrote on last edited by
            #17

            FINALLY !! I've DONE it... The EUREKA moment has come and I thought I should tell u first? Thanks a lot George... Its been a pleasure! "We make a living by what we get, we make a life by what we give." --Winston Churchill That's definately true!

            Rocky You can't climb up a ladder with your hands in your pockets.

            G 1 Reply Last reply
            0
            • R Rocky

              FINALLY !! I've DONE it... The EUREKA moment has come and I thought I should tell u first? Thanks a lot George... Its been a pleasure! "We make a living by what we get, we make a life by what we give." --Winston Churchill That's definately true!

              Rocky You can't climb up a ladder with your hands in your pockets.

              G Offline
              G Offline
              George L Jackson
              wrote on last edited by
              #18

              Congrats! :-D I bet you learned a lot about XSLT doing this exercise. Make sure you write down what you experienced for future reference.

              "We make a living by what we get, we make a life by what we give." --Winston Churchill

              R 2 Replies Last reply
              0
              • G George L Jackson

                Congrats! :-D I bet you learned a lot about XSLT doing this exercise. Make sure you write down what you experienced for future reference.

                "We make a living by what we get, we make a life by what we give." --Winston Churchill

                R Offline
                R Offline
                Rocky
                wrote on last edited by
                #19

                Yes. definately that was a really good one! I learned alot from that. I'll definately make some notes and save that work as well.:-D

                Rocky You can't climb up a ladder with your hands in your pockets.

                1 Reply Last reply
                0
                • G George L Jackson

                  Congrats! :-D I bet you learned a lot about XSLT doing this exercise. Make sure you write down what you experienced for future reference.

                  "We make a living by what we get, we make a life by what we give." --Winston Churchill

                  R Offline
                  R Offline
                  Rocky
                  wrote on last edited by
                  #20

                  hi how ru doing? Can u plz tell me how i can get the distint nodes in an XML. I've searched and found these two options distinct-nodes function for-each-group function and the distinct-values function but I havent been able to use them properly. They belong to XSLT 2.0 and well seems to me like somethings missing. Either the namespace or something? how should I declare it? and I've also visited the saxon website. What exactly do i need to download from there?? I'm confused ? thanks in advance

                  Rocky You can't climb up a ladder with your hands in your pockets.

                  G 1 Reply Last reply
                  0
                  • R Rocky

                    hi how ru doing? Can u plz tell me how i can get the distint nodes in an XML. I've searched and found these two options distinct-nodes function for-each-group function and the distinct-values function but I havent been able to use them properly. They belong to XSLT 2.0 and well seems to me like somethings missing. Either the namespace or something? how should I declare it? and I've also visited the saxon website. What exactly do i need to download from there?? I'm confused ? thanks in advance

                    Rocky You can't climb up a ladder with your hands in your pockets.

                    G Offline
                    G Offline
                    George L Jackson
                    wrote on last edited by
                    #21

                    Actually, I am still studying XSLT 2.0 and haven't looked at those functions yet. If I get a chance, I'll play around with those functions a bit. Saxon-SA 8.9 is the commercial XSLT 2.0 product and Saxon-B 8.9 is the open source one. I believe both products for .NET are really written in Java underneath. Here is the linke again: http://saxon.sourceforge.net/[^].

                    "We make a living by what we get, we make a life by what we give." --Winston Churchill

                    R 1 Reply Last reply
                    0
                    • G George L Jackson

                      Actually, I am still studying XSLT 2.0 and haven't looked at those functions yet. If I get a chance, I'll play around with those functions a bit. Saxon-SA 8.9 is the commercial XSLT 2.0 product and Saxon-B 8.9 is the open source one. I believe both products for .NET are really written in Java underneath. Here is the linke again: http://saxon.sourceforge.net/[^].

                      "We make a living by what we get, we make a life by what we give." --Winston Churchill

                      R Offline
                      R Offline
                      Rocky
                      wrote on last edited by
                      #22

                      ok any ideas abt getting unique nodes from an xml document. for example if u have this kind of a structure how can u get only a and b Rocky You can't climb up a ladder with your hands in your pockets.

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups