[xsl] How to compare the attributes of two elements to ensure that they are equal

Subject: [xsl] How to compare the attributes of two elements to ensure that they are equal
From: Arvind Bassi <arvind_bassi@xxxxxxxxxxx>
Date: Wed, 29 Oct 2003 02:10:22 +0000 (GMT)
What is the best way to compare two elements in terms of their
attributes, and the attribute values? I need to ensure that each
element has the same number of attributes, the same attribute names and
the same attribute values.

I am currently working on a stylesheet which compares two xml
documents, and generates the differences between them. I have used Lar
Huttar's xml document comparison stylesheet as my base (located at
http://www.dpawson.co.uk), but am stuck on augmenting it with checks on
attributes.

I am currently stuck with something along the lines of:

   ...
       <xsl:call-template name="compare-attributes">
          with nodes as parameters
   ...
   <xsl:template name="compare-attributes">
        <xsl:param name="attrA"/>
        <xsl:param name="attrB"/>
        <xsl:for-each select="$attrA/@*">
               .... check that the same attribute exists with
               .... the same attribute exists 
               if it does then compare the values for equality

        </xsl:for-each>
    </xsl:template>

However, l cannot get a handle on each of the two attributes to compare
them. Can somebody help to fill in the blanks?

Thanks.

Arvind.

________________________________________________________________________
Want to chat instantly with your online friends?  Get the FREE Yahoo!
Messenger http://mail.messenger.yahoo.co.uk

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


Current Thread