On 08/10/2026 18:10, Mukul Gandhi mukulg@xxxxxxxxxxxxxxxxx wrote:
> B B B The stylesheet which I've provided, specifies
>
> <xsl:stylesheet xmlns:s="http://s.com/"
> B B B B B B B B B B B B B exclude-result-prefixes="s"
>
> And accordingly, an XML namespace declaration xmlns:s="http://s.com/"
> is not appearing on any XML elements produced by the stylesheet that
> I've cited.
>
> But an XSL instruction
>
> B <xsl:value-of select="s:sort(namespace::*)" separator=","/>
>
> seems to exclude http://s.com/ from the result, using information from
> XSL attribute exclude-result-prefixes. I think, this is probably not
> correct, because the result produced by <xsl:value-of
> select="s:sort(namespace::*)" separator=","/>B is not an XML element
> node.
>
>
My understanding is that the code
B B <xsl:variable name="x" as="element()">
B B B <a a1="a1" xmlns:a="http://a.uri/">
B B B B <b b1="b1">
B B B B B <c/>
B B B B B <d/>
B B B B </b>
B B B </a>
B B </xsl:variable>
with theB exclude-result-prefixes="s" creates an "a" element and its
descendants (like the "c") element without any namespace node for the
s/http://s.com/ namespace.
Then the code
B B B <xsl:for-each select="$x//c">
B B B B <ns>
B B B B B <xsl:value-of select="s:sort(namespace::*)" separator=","/>
B B B B </ns>
B B B </xsl:for-each>
selects the namespace nodes of the "c" element, sorts and outputs them.
As, as I tried to explain above, the "c" element is created as a
descendant of the "a" element while exclude-result-prefixes="s" holds
and that way neither the "a" nor the "c" element node constructed have a
namespace node for s/http://s.com/, the selection of the namespace nodes
of the "c" element with namespace::* doesn't have any node for
"s/http://s.com/" and that way it is also not output, simply as the only
two namespace nodes the "c" element carries are the "a"/"http://a.uri/"
namespace and the XML namespace.
|