Returning a node set from a template

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.


Who is Participating?
Geert BormansInformation ArchitectCommented:
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?


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

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.