xsl-list
[Top] [All Lists]

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

2019-11-06 09:23:33
Am 06.11.2019 um 15:50 schrieb Flanders, Charles E (US)
charles(_dot_)flanders(_at_)baesystems(_dot_)com:
I need help with an issue that I haven't come across before and I'm not even 
sure that I have the subject correct. I am working with XSLT 2.0. Please no 3.0 
solutions.


Which XSLT 2 processor do you use, any access to a proprietary
"serialize" function? Otherwise I guess you will need to write a
function computing some fingerprint, I think Dimitre has posted
solutions on that in the past here.


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.

Write a function that pushes each element through a mode that strips
that attribute, then let it serialize the result or compute a
fingerprint, then use that fingerprint or serialization in
group-adjacent or group-by of for-each-group, pushing the context node
(i.e. first item in a group) through the identity transformation with
the collected

                      <xsl:with-param name="refs" tunnel="yes"
select="current-group()//terefs/teref"/>

as a tunnel parameter:


  <xsl:template match="mac">
      <xsl:copy>
          <xsl:apply-templates select="@*"/>
          <xsl:for-each-group select="*"
group-adjacent="mf:finger-print(.)">
              <xsl:copy>
                  <xsl:apply-templates>
                      <xsl:with-param name="refs" tunnel="yes"
select="current-group()//terefs/teref"/>
                  </xsl:apply-templates>
              </xsl:copy>
          </xsl:for-each-group>
      </xsl:copy>
  </xsl:template>


and insert it in

  <xsl:template match="teref">
      <xsl:param name="refs" tunnel="yes"/>
      <xsl:sequence select="$refs"/>
  </xsl:template>
--~----------------------------------------------------------------
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>