How to compare the attributes of two elements to ensur
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
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format