xslt 2.0 - How to store the input xml data in to map using XSLT2.0 -


i'm tring store input xml data map , how save data.

input xml:

    <person>      <value id="123">         <name>abc</name>         <age>25</age>     </value>     <value id="456">         <name>xyz</name>         <age>80</age>     </value>     <value id="1235">         <name>abcfg</name>         <age>25</age>     </value>     <value id="4568">         <name>xyzd</name>         <age>80</age>     </value>     </person> 

output file:

xyzd|80 abcfg|25 

is there way possible store data map object , print data output?

given input xml,

<person>   <value id="123">     <name>abc</name>     <age>25</age>   </value>   <value id="456">     <name>xyz</name>     <age>80</age>   </value>   <value id="1235">     <name>abcfg</name>     <age>25</age>   </value>   <value id="4568">     <name>xyzd</name>     <age>80</age>   </value> </person> 

the following xslt, work both xslt 2.0 , 1.0,

<xsl:stylesheet version="1.0"                 xmlns:xsl="http://www.w3.org/1999/xsl/transform">   <xsl:output method="text"/>   <xsl:strip-space elements="*"/>    <xsl:template match="value">     <xsl:value-of select="concat(name,'|',age,'&#xa;')"/>   </xsl:template>  </xsl:stylesheet> 

will produce mapping output file,

abc|25 xyz|80 abcfg|25 xyzd|80 

of format requested.


Comments

Popular posts from this blog

android - Gradle sync Error:Configuration with name 'default' not found -

java - Andrioid studio start fail: Fatal error initializing 'null' -

html - jQuery UI Sortable - Remove placeholder after item is dropped -