[Home] [By Thread] [By Date] [Recent Entries]

Subject: xslt 3.0 exclude-result-prefixes question
From: "Mukul Gandhi mukulg@xxxxxxxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 8 Oct 2026 15:06:47 -0000
Dear xsl-list,
     Writing a mail to this list, after a long time I guess.

I've a question about XSLT 3.0 attribute 'exclude-result-prefixes'.

Within one of W3C XSLT 3.0 test suite test cases, I am able to see an XSL
stylesheet, as follows

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

                         xmlns:s="http://s.com/"
                         exclude-result-prefixes="s"
                         version="3.0">

  <xsl:template match="/">
    <xsl:variable name="x" as="element()">
      <a a1="a1" xmlns:a="http://a.uri/">
        <b b1="b1">
          <c/>
          <d/>
        </b>
      </a>
    </xsl:variable>
    <zzz>
      <xsl:for-each select="$x//c">
        <ns>
          <xsl:value-of select="s:sort(namespace::*)" separator=","/>
        </ns>
      </xsl:for-each>
    </zzz>
  </xsl:template>

  <xsl:function name="s:sort">
    <xsl:param name="seq"/>
    <xsl:perform-sort select="$seq">
      <xsl:sort/>
    </xsl:perform-sort>
  </xsl:function>

</xsl:stylesheet>

W3C XSLT 3.0 test suite, specifies the following expected result for this
XSL stylesheet,

<zzz><ns>http://a.uri/,http://www.w3.org/XML/1998/namespace</ns></zzz>

Whereas I think, the correct output for this XSL stylesheet should be
following,

<zzz><ns>http://a.uri/,http://s.com/,http://www.w3.org/XML/1998/namespace
</ns></zzz>

XSLT 3.0 spec, specifies that
[xsl:]exclude-result-prefixes is applicable to 'Literal Result Elements',
and refers the reader to following section of XSLT 3.0 spec,
see 11.1.3 Namespace Nodes for Literal Result Elements


Any thoughts please?


-- 
Regards,
Mukul Gandhi

Current Thread
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member