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

Comparison of nodes minus a child node

Subject: Comparison of nodes minus a child node
From: mjyoungblut@xxxxxxx
Date: Tue, 30 Oct 2001 16:37:20 -0600
xsl minus
I have two sets of elements
<ListofHierarchies>
     <Hierarchy>
          <Child1>...</Child1>
          <Child2>...</Child1>
          ...
          <Child7>...</Child7>
     </Hierarchy>
</ListofHierarchies>

I want to compare these two ListofHierarchies, but I don't want to include
<Child7> in the comparison.  Here is the XSL that I currently use.  It
produces the results that I desire, but it is slow, even if the Hierarcy
elements are the same between the two sets.  The test that I am running has
about 80,000 hierarchy elements.  If I run the whole XSL with the following
snippet included, it takes 16 minutes; with the snipped commented out, it
takes about 2 minutes.  So this is definitely what is holding me back.

Does anybody have another solution to take out the <Child7> element, and
compare the Hierarchy elements in a faster way?

<xsl:if test="$TODAY_PROD//ListofHierarchies or
$YEST_PROD//ListofHierarchies">
     <xsl:variable name="TODAY_HIERS"><xsl:apply-templates select
="$TODAY_PROD//ListofHierarchies//Hierarchy"
                                              mode
="hierarchy"><xsl:sort/></xsl:apply-templates></xsl:variable>
     <xsl:variable name="YEST_HIERS"><xsl:apply-templates select
="$YEST_PROD//ListofHierarchies//Hierarchy"
                                              mode
="hierarchy"><xsl:sort/></xsl:apply-templates></xsl:variable>
     <xsl:if test="not($TODAY_HIERS=$YEST_HIERS)">
          <ListofHierarchies>
               <xsl:for-each select
="$TODAY_PROD//ListofHierarchies//Hierarchy">
                    <xsl:variable name="IND_TODAY"><xsl:apply-templates
select="." mode="hierarchy"/></xsl:variable>
                    <xsl:if test="not($IND_TODAY
= $YEST_HIERS//Hierarchy)">   <!-- Hierarchy is an Add -->
                         <xsl:copy-of select = "."/>
                    </xsl:if>
               </xsl:for-each>
               <xsl:for-each select
="$YEST_PROD//ListofHierarchies//Hierarchy">
                    <xsl:variable name="IND_YEST"><xsl:apply-templates
select="." mode="hierarchy"/></xsl:variable>
                    <xsl:if test="not($IND_YEST
= $TODAY_HIERS//Hierarchy)">
                         <xsl:apply-templates select="." mode="delete"/>
                    </xsl:if>
               </xsl:for-each>
          </ListofHierarchies>
     </xsl:if>
</xsl:if>

<xsl:template match="node()|@*" mode
="delete"><xsl:copy><xsl:apply-templates select="node()|@*" mode
="delete"/></xsl:copy></xsl:template>
<xsl:template match="@Action" mode="delete"><xsl:attribute name
="Action">D</xsl:attribute></xsl:template>

<xsl:template match="node()|@*" mode
="hierarchy"><xsl:copy><xsl:apply-templates select="node()|@*" mode
="hierarchy"/></xsl:copy></xsl:template>
<xsl:template match="HierarchyDotNotation" mode="hierarchy"/>

Thank you in advance,
     Matt Youngblut




 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.