Wednesday, 12 October 2016

XML : How can I use apply a template to each node with a unique attribute?

Is it possible to apply a template that only matchings on the unique attributes?

  <node name="region">1</node>  <node name="region">2</node>  <node name="region">3</node>  <node name="place">a</node>  <node name="place">b</node>  <node name="title">test</node>    

I want to execute a template once for @name="region" and once for @name="place". Can this be done using XSLT/XPATH 1.0?

My ultimate goal is JSON output that looks like this:

  container:{  "region":["1","2","3"],  "place":["a","b"],  "title":"test"  }    

No comments:

Post a Comment