Source XML:
<books xmlns="www.flipkart.com" xmlns:sport="www.flipkart.com/sports">
<book xmlns:sport="www.flipkart.com/sports" xmlns:bio="www.flipkart.com/sports/bio">
<name>Open</name>
<author>Agassi</author>
</book>
<book xmlns:sport="www.flipkart.com/sports" xmlns:bio="www.flipkart.com/sports/bio">
<name>Bounce</name>
<author>Matthew Syed</author>
</book>
</books>
XSLT:
Copy the source xml without any change
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema" version="2.0">
<xsl:template match="/">
<xsl:copy-of select="/"/>
</xsl:template>
</xsl:stylesheet>
Output:
Common namespace between parent and child does not appear
<books xmlns="www.flipkart.com" xmlns:sport="www.flipkart.com/sports">
<book xmlns:bio="www.flipkart.com/sports/bio">
<name>Open</name>
<author>Agassi</author>
</book>
<book xmlns:bio="www.flipkart.com/sports/bio">
<name>Bounce</name>
<author>Matthew Syed</author>
</book>
</books>
My desired behavior is copy source xml without any change.After transformation common namespace(xmlns:sport="www.flipkart.com/sports") between parent "books" and child "book" is not appearing in output
Expected:
<book xmlns:sport="www.flipkart.com/sports" xmlns:bio="www.flipkart.com/sports/bio">
Actual:
<book xmlns:bio="www.flipkart.com/sports/bio">
How to include child namespace in the output ?
Thanks