The serializer is responsible for whether an empty element is emitted as <abc></abc>
or <abc/>
, and they are exactly equivalent. Some serializers give no option, and will always produce one or the other.
But it might be that you are emitting whitespace between them; in that case you'll have to change the xsl:copy
to something else that doesn't include the insignificant whitespace, like by adding or text() = ''
to your predicate.
As far as eliminating the xmlns:core
namespace declaration, that depends on your context. It will be generated always if there is an element that requires it inside of your type, or if you're using XSLT and haven't excluded the namespace with the @exclude-result-prefixes
attribute on the <xsl:stylesheet>
root element. And even then, depending on your processor environment, the serializer may "decide" that it wants that namespace output needlessly, since it was in scope in the input.
Also, it's kind of odd to see <xsl:copy> ... <xsl:copy-of .../> ... </xsl:copy>
. You really shouldn't wrap the copy-of
inside of the copy
s. Just make it copy-of
.