XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Viral GuptaSubject: check for duplicates.
Author: Viral Gupta
Date: 10 Mar 2007 01:33 AM

I am having problem with removing duplicate entires.
Need help.

Follwing is the XMl schema.

<Paper monthid="some number">
<Area> </Area>

ideally Author tags will have same names but not necessarily in same order. so we want to only compare year, topic

Also if u know sm way by which even if authors names follow a different sequence and still can be checked ...then that should be gr8!!...

following is the xslt we are using.

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
<xsl:template match="/">

<html >
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="css/stylesheet.css" rel="stylesheet" type="text/css" media="all" />

<h2>Wireless Security</h2>
<xsl:for-each select="Publications/Paper">
<xsl:sort select="Year" data-type="number" order="descending"/>
<xsl:sort select="@monthid" data-type="number" order="descending"/>

<xsl:if test="Area ='Wireless Security'">
<xsl:value-of select="Topic"/>


<xsl:for-each select="Author">

<xsl:if test="Name!='false'">
<xsl:value-of select="Name"/>
<xsl:if test="not(position()=last())">
<xsl:text>, </xsl:text>
<!-- <xsl:if test="position()=last()">
<xsl:when test="string-length(Full-Paper-link)">
<xsl:text> </xsl:text>
<xsl:attribute name="href"><xsl:value-of select="Full-Paper-link"/> </xsl:attribute >
<span style="color: #0000ff">
<xsl:if test="string-length(Abstract-link)">
<xsl:text> </xsl:text>
<xsl:attribute name="href"><xsl:value-of select="Abstract-link"/> </xsl:attribute >
<span style="color: #0000ff">
<xsl:value-of select="Conference"/>

<xsl:if test="string-length(Month)">
<xsl:text>, </xsl:text>
<xsl:value-of select="Month"/>
<!--<xsl:if test="Year!='false'">-->
<xsl:if test="string-length(Year)">
<xsl:text> </xsl:text>
<xsl:value-of select="Year"/>
<xsl:if test="string-length(Abstract)">
<xsl:text> </xsl:text>
<xsl:value-of select="Abstract"/>


Thanks a lot for the help.

James DurningSubject: check for duplicates.
Author: James Durning
Date: 15 Mar 2007 11:42 AM
I think you can use Muenchian grouping to solve your problem. http://www.jenitennison.com/xslt/grouping/muenchian.html

You'd have at top of stylesheet:
<xsl:key name="Authors-by-Name" match="Author" use="Name" />

And Instead of <xsl:for-each select="Author">
you'd have
<xsl:for-each select="Author[count(. | key('Authors-by-Name', Name)[1]) = 1]"> <!-- gets unique authors by name -->

Inside this for-each loop, to get all authors with the same name, you'd put:
<xsl:for-each select="key('Authors-by-Name', Name)">

Not entirely sure what you want as end output, so you might want an <xsl:sort> inside the first for-each or something else.

Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.