I have two xml documents, the one is a service request and the other a query response. (This is done in Mediator with multi part message). I want to copy the result of the query into the service request document, this works fine except that the namespaces are copied as wel and I don’t want them.
Here is my transformation, at the moment the second document is a file.
<xsl:stylesheet xmlns:xsl=“XSLT Namespace” version=“1.0”>
<xsl:output method=“xml” indent=“yes” encoding=“UTF-8” media-type=“text/xml”/>
<xsl:param name=“BD.path”/>
<xsl:template match=“/” >
<xsl:copy-of select=“Service”/>
<Result
xmlns:xql=“XQL FAQ (XML Query Language - Frequently Asked Questions)”
xmlns:ino=“http://namespaces.softwareag.com/tamino/response2”
xmlns:xq=“http://namespaces.softwareag.com/tamino/XQuery/result”
xsl:exclude-result-prefixes=“ino xql xq”>
<xsl:copy select=“document(‘C:\Development\BD\QueryTst.xml’)/ino:response/xq:result/*”/>
</xsl:template>
</xsl:stylesheet>
Hi,
I guess your second xsl:copy must also be a xsl:copy-of since
xsl:copy does not allow for a select attribute.
Anyway, to get rid of the namespaces use xsl:apply-templates
instead of copying to run the nodes taken from the query output
through a namespace-reducing transformation as follows:
<xsl:template match=““>
<xsl:element name=”{local-name()}“>
<xsl:for-each select=”@”>
<xsl:attribute name=“{local-name()}”>
<xsl:value-of select=“.”/>
</xsl:attribute>
</xsl:for-each>
xsl:apply-templates/
</xsl:element>
</xsl:template>
If your stylesheet includes other transformations besides
those pertaining to xquery output, use modes.
Regards,
Juliane
Thanks Juliane, that was exactly what I needed.