[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Assistance with the Muenchian method

Subject: Assistance with the Muenchian method
From: "Renick, Garrel" <garrel@xxxxxxxx>
Date: Mon, 10 Dec 2001 13:11:02 -0600
tomcat virtual path
Hello. I desperately need assistance with removing duplicate XML data.
I'm attempting to use the Muenchian method referred to in some of the
posts on this list, but I'm not having success. 

I'm using the Xalan XSL processor that comes with the Tomcat application
server.

My data looks like this:

<document>
<output scope="session">
  <userData>
    <publish pid="6">
      <website oid="1" wid="5" path="/:/" virtual="true" secure="false"
tomcat="false">
        <name>Global</name>
        <location type="http">
          <path>WebPublish/web/www</path>
          <url>http://null/</url>
        </location>
        <location type="log">
          <path>WebPublish/web/logs</path>
        </location>
      </website>
      <website webdomain="www.test.org" oid="1" wid="1"
path="/:/www.test.org" virtual="false" secure="false" tomcat="true">
        <name>test Documentation</name>
        <location type="http">
          <path>WebPublish/web/www.test.org/www</path>
          <url>http://www.test.org/</url>
        </location>
      </website>
    </publish>
    <publish pid="29">
      <website oid="1" wid="5" path="/:/" virtual="true" secure="false"
tomcat="false">
        <name>Global</name>
        <location type="http">
          <path>WebPublish/web/www</path>
          <url>http://null/</url>
        </location>
        <location type="log">
          <path>WebPublish/web/logs</path>
        </location>
      </website>
    </publish>
  </userData>
</output>
</document>

What I need to do is build an html select list with information from
every <website>, but only display each website once...the <website> with
the same @wid may appear multiple times in the data with a different
<publish> parent.

I'm currently doing the following in my code:

<xsl:key name="groups-by-wid"
match="/document/output[@scope='session']/userData/publish/website"
use="@wid"/>
<xsl:apply-templates
select="/document/output[@scope='session']/userData">

<xsl:template match="userData">
  <xsl:for-each
select="publish/website[generate-id()=generate-id(key('groups-by-wid',
@wid)[1])]">
    <xsl:sort select="@path"/> 
    <xsl:variable name="wid" select="@wid"/>
    <xsl:for-each select="key('groups-by-wid', $wid)">
      <xsl:variable name="path" select="@path"/>
      <xsl:variable name="wid" select="@wid"/>
      <option value="{$wid}"><xsl:value-of select="$path"/></option>
    </xsl:for-each>
  </xsl:for-each>
</xsl:template>

This isn't working. Two options for the website with wid=5 are
displayed. I think it must have something to do with the <website
wid="5"> elements having different parents, but I'm not sure.

Do any of you with experience in this technique see the problem with my
code? 

Regards,
Garrel Renick
garrel@xxxxxxxx 

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.