Thursday, 3 December 2015

XML : How to select name of the first child node of the current node in xslt

i have an xml that contains various group items, some of which contains a element within:

  <foo id="2">     <row>13/<row>  </foo>  <xxx id="3">    <text>aaa</text>  </xxx>  <aaa id="4">    <row>17</row>  </aaa>    

Those that has nested has to be transformed: the should be wrapped into and attributes copied from the to the

  <foo>       <value id="4">           <row>13</row>       </value>   </foo>     

In order to do it, i have to find whether my current element has a child called "row". Is there a generic way to do it in xslt? I tried test="name(node()/*[1])='row'"but it didn't select anything.

No comments:

Post a Comment