Input xml is :
<A>
<B>
<c>1</c>
<c>2</c>
</B>
<D>
<c>2</c>
开发者_StackOverflow中文版 <c>3</c>
</D>
</A>
From the above xml i want the o/p as <c>2</c>
It is not clear what the criteria is for outputting that single element. Do you want to group and then only output groups with more than one item? In that case
<xsl:template match="/">
<xsl:for-each-group select="descendant::c" group-by=".">
<xsl:if test="current-group()[2]">
<xsl:copy-of select="."/>
</xsl:if>
</xsl:for-each-group>
</xsl:template>
might suffice. If not then explain in more detail why the output should be as posted.
精彩评论