xsl-list
[Top] [All Lists]

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

2019-11-06 12:03:39
On Wed, 2019-11-06 at 14:50 +0000, Flanders, Charles E (US)
charles(_dot_)flanders(_at_)baesystems(_dot_)com 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
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--

<Prev in Thread] Current Thread [Next in Thread>