Re: [xsl] Comparing node-sets or groups. Deep-equal with an exception?

Subject: Re: [xsl] Comparing node-sets or groups. Deep-equal with an exception?
From: "Liam R. E. Quin liam@xxxxxxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 6 Nov 2019 18:03:31 -0000
On Wed, 2019-11-06 at 14:50 +0000, Flanders, Charles E (US)
charles.flanders@xxxxxxxxxxxxxx wrote:
> I have a long list of <mac-group-2lvl>  structures as below. Most are
> unique. However in some cases, they are identical except for the
> "ref" attribute value on the <teref>  element.

One approach:

So, you can easily identify the ones you need to process differently:

1/ if they are identical, then deep-equal will be true.

2/ make an identity template and a template that will set the ref
attribute to "marmaduke", use a mode (since XSLT 2 doesn't have
fn:transform), and then use deep-equal

3/ encapsulate this in an XSLT function, and now you can write an
xsl:choose with test="my:i-need-to-update-ref-attribute(., $other):"

4/ the xsl:choose would ignore the following siblings that are already
processed in the earlier case (or write a recursive template or
function that consumes one or more structures each time round).


Liam

-- 
Liam Quin, https://www.delightfulcomputing.com/
Available for XML/Document/Information Architecture/XSLT/
XSL/XQuery/Web/Text Processing/A11Y training, work & consulting.
Barefoot Web-slave, antique illustrations:  http://www.fromoldbooks.org

Current Thread