I want merge elements that are same for example:
<Root>
<row>
<WID>10</WID>
<word>Bob</word>
<SID>2</SID>
<Ah>1</Ah>
</row>
<row>
<WID>5941</WID>
<word>Jany</word>
<SID>2</SID>
<Ah>1</Ah>
</row>
</Root>
And result be:
<span>Bob Jany</span>
I write this but it is wrong:
<xsl:choose>
<xsl:when test = "Ah[text()]=Ah[text()]">
<span>
<xsl:value-of select="./word"/>
</span>
</xsl:when>
</xsl:choose>
An XSLT 1.0 solution using the Muenchian Grouping Method:
When this transformation is applied on the provided XML document:
the wanted, correct result is produced:
Use grouping, with XSLT 2.0 (run by Saxon 9 or AltovaXML or XmlPrime) it is as easy as
When I apply the stylesheet above with Saxon 9.5 HE on the input sample
I get the result