• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 330
  • Last Modified:

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
<parent>
  <name>john</name>
  <amount>50</amount>
<parent>

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]/>
  </xsl:call-template>
</xsl:variable>

as example of the result node would be as
<person>
  <name>john</name>
  <balance>positive</balance>
</person>


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.

thanks

0
singhch
Asked:
singhch
1 Solution
 
R7AFCommented:
If you can, give us the complete template. And a good xml sample (up to the root) would really help!
0
 
Geert BormansCommented:
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?

cheers

Geert
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now