开发者

Complaring Mulitple Element's text with multiple Elements text in xslt

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜