xml - XSLT to remove duplicate node and attribute -


need remove duplicate entry in xml using xslt1.0 , how can acheived ?

 example : below input xml , need unique image element      <image source="marginal_links_orange.png"/>      <image source="marginal_programme_home.png"/>      <image source="marginal_programme_guide.png"/>      <image source="marginal_links_orange.png"/>      <image source="marginal_programme_home.png"/>     expected output :      <image source="marginal_links_orange.png"/>     <image source="marginal_programme_home.png"/>     <image source="marginal_programme_guide.png"/> 

i think solve problem

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform"   xmlns:fo="http://www.w3.org/1999/xsl/format"> <xsl:output method="html" indent="yes"/>     <xsl:template match="/">         <xsl:apply-templates select="//image[@source]"/>             </xsl:template>     <xsl:template match="image[@source]">                    <xsl:if test="not(preceding-sibling::image[@source = current()/@source])">             <xsl:copy-of select="."/>             <xsl:text>&#13;&#xa;</xsl:text>         </xsl:if>     </xsl:template> </xsl:stylesheet> 

Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -