Re: [xsl] Help namespacing an attribute

Subject: Re: [xsl] Help namespacing an attribute
From: "G. Ken Holman g.ken.holman@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 20 Sep 2017 18:27:13 -0000
Ha! Well, I don't drink alcohol, but I enjoy bagels!

There is a "Donate" button on my web site where I
hope that anyone who finds value in my
contributions (posts, books, free developer
resources, etc.) to the community will consider
reflecting that value in a donation.

I eventually found it too difficult to set a
"fee" for contributions because the value to
users for any given tidbit is different from one
user to another.  So I hope users recognize the
value they realize from volunteer work and
consider helping those who help with a donation.

I confess that the button has been used but once
in the years I have made it available, so I
cannot attest to it being a good business
model.  I guess there isn't much perceived value
in volunteer contributions.  I feel for the
application developers of all those free tools I
pay for who work on the donation model.

Yes, the definition of
exclude-result-prefixes="#all" is to strip *all*
namespace nodes from the template nodes of
elements targeted for the result tree.  And so
your document element (and other elements from
your templates) go out without the XLink
namespace.  The serializer notices this and has
no ancestry on which to rely for the declaration
of the XLink namespace where it is needed, so it
is obliged to serialize that declaration as part of the element that needs

. . . . . . . Ken

At 2017-09-20 18:05 +0000, Bridger Dyson-Smith bdysonsmith@xxxxxxxxx wrote:

That is absolutely brilliant! I don't think I've
ever encountered this before (or, rather, I
probably have encountered it, but didn't recognize it for what it was).

On Wed, Sep 20, 2017 at 1:48 PM, G. Ken Holman
At 2017-09-20 17:43 +0000, Bridger Dyson-Smith
<mailto:bdysonsmith@xxxxxxxxx>bdysonsmith@xxxxxxxxx wrote:
As I mentioned to Ken, I've done this on both
the test transform and the 'real world'
transform but the difference in serialization
behavior is what prompted the question.
Is there anything else I could try with this? Am
I adding the xmlns:xlink declaration on the wrong document element?

No, you have this:

B B B B B B B B exclude-result-prefixes="#all"

... which is stripping (excluding) the namespace
from the <mods> document element.

In your test stylesheet you aren't stripping it off of the document element.

I did not realize that exclude-result-prefixes
would have this impact. How can I send you a
beer (or some other beverage of your choice)?

. . . . . Ken


Contact info, blog, articles, etc. |
Check our site for free XML, XSLT, XSL-FO and UBL developer resources |
Streaming hands-on XSLT/XPath 2 training class @ US$45 (5 hours free) |

Current Thread