How to transform xml structure using XSLT-1.0

crimo1274

New Member
I need to transform this structure\[code\]<A><B>value1</B></A><A><B>value2</B></A>\[/code\]into\[code\]<A><B>value1<B><B>value2<B></A>\[/code\]What is best solution using XSLT-1.0?Thank you!PS: I tried this code: \[code\]<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format"> <xsl:output method="xml" version="1.0" encoding="utf-8" indent="yes"/> <xsl:key name="group_a" match="//A" use="B"/> <xsl:template match="/Test"> <a-node> <xsl:for-each select="//A"> <b-node> <xsl:value-of select="//A/B"/> </b-node> </xsl:for-each> </a-node> </xsl:template> </xsl:stylesheet> \[/code\]but it returns only first value: \[code\]<?xml version="1.0" encoding="utf-8"?> <a-node mlns:fo="http://www.w3.org/1999/XSL/Format"> <b-node>value1</b-node> <b-node>value1</b-node> </a-node> \[/code\]but I need:\[code\]<?xml version="1.0" encoding="utf-8"?> <a-node xmlns:fo="http://www.w3.org/1999/XSL/Format"> <b-node>value1</b-node> <b-node>value2</b-node> </a-node>\[/code\]
 
Back
Top