[Top] [All Lists]

Re: [xsl] XSLT3 deep-equal() question

2020-03-27 13:24:59
Sadly, we are not doing schema-validation.

Thanks for the confirmation, Michael.  I can now forge ahead with

Martin, to address your question, I will have other templates in the mode,
obviously to "change things" w.r.t. the original document events.  But what
I want to know is if I can rely on deep-equal() to tell if a change has
been made.

BTW, Martin, I find your site to be an excellent tool.  Thanks so much for
(i.e. https://xsltfiddle.liberty-development.net/ )

Thanks very much for the confirmation -- mischief managed -- and have good
confined weekend.

On Fri, Mar 27, 2020 at 6:35 PM Michael Kay mike(_at_)saxonica(_dot_)com <
xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> wrote:

The shallow-copy drops type annotations on element nodes, so there could
be a false result if the input is typed (i.e. schema-validated). The effect
of type annotations on deep-equal() is somewhat arcane (I have no
recollection of how the rules were arrived at).

Apart from that I think you're guaranteed a true result. But I could be

I can't see why having external entities would make any difference.

Michael Kay

On 27 Mar 2020, at 16:43, Alan Painter 
alan(_dot_)painter(_at_)gmail(_dot_)com <
xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> wrote:

Hello XSLT Community,

I'm Using XSLT3 (Saxon 9.9 HE).

I'm wondering if it's reasonable to expect deep-equal() to always return
true in the following scenario.  I suspect "yes" but wondering what corner
cases that I might encounter.

We'll be pushing some data-oriented source documents, with no external
entities, through templates which are all in a mode defined from
"shallow-copy" similar to the below.

What I'm wondering under what conditions of source documents that the
following stylesheet would return "false" rather than "true".  (Again,
excluding external entities.) I'm hoping that the list of conditions is nil
or very small.

Thanks for any help.


  <xsl:mode name="a" on-no-match="shallow-copy"/>

  <xsl:output method="text" />

  <xsl:template match="/" >
      <xsl:variable name="afterApply">
          <xsl:apply-templates select="/" mode="a"/>
      <xsl:sequence select="deep-equal(/, $afterApply) => string()" />


Alan Painter
Confined in France

XSL-List info and archive <http://www.mulberrytech.com/xsl/xsl-list>
EasyUnsubscribe <http://lists.mulberrytech.com/unsub/xsl-list/293509> (by

XSL-List info and archive <http://www.mulberrytech.com/xsl/xsl-list>
EasyUnsubscribe <http://lists.mulberrytech.com/unsub/xsl-list/552232> (by
email <>)

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>