Saxon exclude-result-prefixes dropping namespace for attribute values



I have this weird problem with Saxon's XSLT processor (latest version = 9.?)


Given this bogus XML (doesn't matter what it is):



<?xml version="1.0" encoding="UTF-8"?>
<root xmlns="urn:bogus">bogus</root>


With this XSLT:



<?xml version="1.0" encoding="UTF-8"?>
<x:transform version="2.0"
xmlns:x="http://ift.tt/tCZ8VR"
xmlns:b="urn:bogus"
xmlns:xs="http://ift.tt/tphNwY"
xmlns:xsi="http://ift.tt/ra1lAU"
xmlns="urn:foobar"
xpath-default-namespace="urn:foobar"
exclude-result-prefixes="#all">

<x:output method="xml" indent="yes" encoding="UTF-8" />

<x:template match="b:root">
<foo xsi:type="xs:string"><x:value-of select="."/></foo>
</x:template>

</x:transform>


Will actually drop the xmlns:xs="http://ift.tt/tphNwY" declaration from the resulting XML because of exclude-result-prefixes="#all". Apparently this happens because it is used in an attribute value and not in an element or attribute.


Removing exclude-result-prefixes="#all" or specifying manually which prefixes to remove does work.


Is this intended behavior? I guess the processor treats all attribute values as random strings and doesn't take namespaces into account for them (it doesn't even notice it has one I assume).


Should there be special behavior for well known attributes like xsi:type?


No comments:

Post a Comment