I can make it working by adding a
prefix to the default namespace (the
last one), but how could I output a
XML without adding a prefix, it is
possible by using XslCompiledTransform
in .NET 4 ?
Here is a concrete example how to do it:
This transformation:
<xsl:stylesheet version="1.0"
xmlns="http://workflow.converga.com.au/compass"
xmlns:c="http://workflow.converga.com.au/compass"
xmlns:ext="http://exslt.org/common"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
exclude-result-prefixes="c ext xsl">
<xsl:output omit-xml-declaration="yes" indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:param name="pnewItem">
<item name="wine">
<price>3</price>
<quantity>5000</quantity>
</item>
</xsl:param>
<xsl:template match="node()|@*" name="identity">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="c:item[last()]">
<xsl:call-template name="identity"/>
<xsl:copy-of select="ext:node-set($pnewItem)/*"/>
</xsl:template>
</xsl:stylesheet>
when applied with XslCompiledTransform on the following XML document:
<pExport xmlns="http://workflow.converga.com.au/compass">
<Goods>
<item name="tobacco">
<price>5</price>
<quantity>1000</quantity>
</item>
</Goods>
</pExport>
produces the wanted (the same XML document with a new item added), correct result:
<pExport xmlns="http://workflow.converga.com.au/compass">
<Goods>
<item name="tobacco">
<price>5</price>
<quantity>1000</quantity>
</item>
<item name="wine">
<price>3</price>
<quantity>5000</quantity>
</item>
</Goods>
</pExport>