[xsl] Merging multiple documents efficiently

Subject: [xsl] Merging multiple documents efficiently
From: mjyoungblut@xxxxxxx
Date: Fri, 2 Feb 2001 14:36:14 -0600
I have multiple documents, files A, B, and C.  I want to join them on the
id of the first, but only if a matching id is in the 2nd or 3rd.  How do I
do this?

NOTE: File A is my source file.  I call document( ) to match against B and
C
Example:
File A              File B               File C              Desired Output
<id>A</id>          <id>A</id>           <id>B</id>          <id>A</id>
<id>B</id>          <id>D</id>           <id>D</id>          <id>B</id>
<id>D</id>                                         <id>D</id>
<id>D</id>
<id>E</id>

Here is (part of) my existing code.  It generally works, but is quite
inefficient for large input files.

<xsl:template match="Hierarchy">
     <xsl:for-each select="NodeID[. = $PRD/ListofProducts/Product/NodeID]|
                      NodeID[. = $HRY/Hierarchies/Hierarchy/NodeID]|
                      NodeID[. = $MSD/MDSDs/MSDS/NodeID]">
          <xsl:for-each select="..">
               // Perform matching based on NodeID
               ...
          </xsl:for-each>
     </xsl:for-each>
</xsl:template>

Thanks,
     Matt Youngblut


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


Current Thread