Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Create xmlns attribute in the XML using XSLT Transformation

neilghoshAug 29 2012 — edited Aug 30 2012
I am trying to add the xmlns attribute to the resulting XML with a value passed by parameter during XSLT transformation using JDK Transformer but it always defaults to http://www.w3.org/2000/xmlns/

My source XML

<test/>

My XSLT

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://example.com">
<xsl:param name="myNameSpace" select="'http://neilghosh.com'"/>
<xsl:template match="/">
<process>
<xsl:attribute name="xmlns:neil">
<xsl:value-of select="$myNameSpace"/>
</xsl:attribute>
</process>
</xsl:template>
</xsl:stylesheet>

My Result

<?xml version="1.0"?>
<process xmlns="http://www.w3.org/2000/xmlns/" xmlns:neil="neilghosh.com">
</process>

My Desired Result

<?xml version="1.0"?>
<process xmlns="http://example.com" xmlns:neil="neilghosh.com">
</process>

Cross-posted at [stackoverflow |http://stackoverflow.com/questions/12179258/create-xmlns-attribute-in-the-xml-using-xslt-transformation/12179409]
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 27 2012
Added on Aug 29 2012
1 comment
771 views