RE: Intersection Problem

Subject: RE: Intersection Problem
From: Kay Michael <Michael.Kay@xxxxxxx>
Date: Tue, 25 Jul 2000 11:23:32 +0100
> How I can "Intersect" document 2 with document 1 so that it brings the
> <statResult> nodes which have the equal number or more 
> drilldown nodes found
> in doc 2. (The intersection key is drilldownType)

I'm not really sure what you mean by "intersect" - it would help to give an
indication of the output you expect. I suspect you mean that you want to
augment document2 by adding the drillDownName corresponding to each
drillDownType. (I'd call that a join rather than an intersection). The
obvious way to do this is to define a key:

<xsl:key name="ddt" match="DrillDown" use="DrillDownType"/>

and then process document 2 by writing:

<xsl:template match="drillDown">
   <xsl:copy-of select="DrillDownType"/>
   <xsl:variable name="ddt" select="DrillDownType"/>
   <xsl:for-each select="document('doc1')">
      <xsl:copy-of select="key('ddt', $ddt)/DrillDownName"/>
   </xsl:for-each>
</xsl:template>

Mike Kay


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


Current Thread