Returning a node set from a template

Posted on 2007-07-27
Last Modified: 2013-11-18
Hi there,

I have been using templates where I pass in a node set and the template returns a single value.

Just wondering if it is possible to pass a parameter which contains a node set to a template. And this template does some processing to this node set and generates another node set.  

for eg. my node set is such

so I call the template in my xslt
<xsl:variable name="result_node">
  <xsl:call-template name="process_parent">
    <xsl:param name="myNode" select=parent[1]/>

as example of the result node would be as

pls note that the reason I am asking this is becoz i am using Altova mapforce and I am trying to keep the logic within the template.


Question by:singhch
    LVL 13

    Expert Comment

    If you can, give us the complete template. And a good xml sample (up to the root) would really help!
    LVL 60

    Accepted Solution

    yes, you can do this,
    as long as the nodes you are passing are part of the source tree
    This means that you cannot create a part of the result tree and use XPath addressing in this newly created XML
    as long as you are simply passing a reference to a selection of the source, there is no problem

    note that most XSLT1 processors have an extension for node-sets
    with this extension you can even pass result tree fragments

    Is there something that didn't work when you tested this,
    or is this a general question?



    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    Join & Write a Comment

    Most of the sites are being standardized with W3C Web Standards. W3C provides lot of web standard services to the web. They have the web specification, process and documentation for all the web standards. You can apply HTML, CSS and Accessibility st…
    This article provides a case study on how our local youth baseball league deployed a new website, including the platform selection, implementation and benefits to the league.
    The viewer will learn how to dynamically set the form action using jQuery.
    HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

    732 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now