Skip to Content

How to remove only xml header and not namespace after mapping in HCI

Dec 14, 2017 at 02:15 PM


avatar image

Hi Experts,

I have a XML file and want to remove <?xml version="1.0" encoding="UTF-8"?>

without losing ns0 from other tags.

<?xml version="1.0" encoding="UTF-8"?>
<ns0:Save xmlns:ns0="">

when i am using XSLT mappingmentioned below,its removing all "ns0" tags as well.

So i probably need a groovy code for my HCI

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="">
    <xsl:output indent="yes" method="xml" encoding="utf-8" omit-xml-declaration="yes"/>
    <xsl:template match="*">
        <xsl:element name="{local-name()}">
            <xsl:apply-templates select="@* | node()"/>
    <xsl:template match="@*">
        <xsl:attribute name="{local-name()}">
            <xsl:value-of select="."/>
    <xsl:template match="comment() | text() | processing-instruction()">

Please help.

Thanks and Regards,


10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Evgeniy Kolmakov Dec 14, 2017 at 02:27 PM

Hi Thouheed!

And why not to use:

<xsl:template match="/">
<xsl:copy-of select="."/>

You use local-name() function which returns only element name without namespace prefix.

Regards, Evgeniy.

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Hi Evgeniy,

Thanks for quick response, i found some other solution its working fine.

Thanks and Regards,