Aliasing prefixes (not namespaces) in XSLT



I want to change the prefix in the output from the prefix in the stylesheet itself.


XSLT file:



<stylesheet version="1.0" xmlns:a="nsA">
<template match="/">
<a:out/>
</template>
</stylesheet>


What I get:



<a:out xmlns:a="nsA" />


What I want:



<b:out xmlns:b="nsA" />


Note that I want to change only the prefix, not the namespace. The element namespace-alias will translate only the namespace, leaving the prefix intact.


Bonus points if it is possible to remove the prefix completely:



<out xmlns="nsA" />


Note that the XSLT elements are not prefixed and the output elements are prefixed. It has to remain like that. I know that the problem could be solved with prefixing XSLT and un-prefixing output elements, but it's not an option. The to-be-output elements must have the prefix as provided in the stylesheet, only in the output should they be changed.


No comments:

Post a Comment