Get value out of two tags
File: Data.xml
<?xml version="1.0" encoding="utf-8"?>
<emailList>
<person>
<name>person1</name>
<email>p@hotmail.com</email>
</person>
<person>
<name>person2</name>
<email>p@hotmail.com</email>
</person>
<person>
<name>person3</name>
<email>p3@hotmail.com</email>
</person>
</emailList>
File: Transform.xslt
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text"/>
<xsl:template match="/emailList/person">
<xsl:value-of select="name"/>,<xsl:value-of select="email"/>
</xsl:template>
</xsl:stylesheet>
Output:
person1,p@hotmail.com
person2,p@hotmail.com
person3,p3@hotmail.com
Related examples in the same category