coachoutlet3lxh
New Member
I have beow input xml\[code\] <?xml version='1.0' encoding='UTF-8'?> <fde-request xmlns="http://xml-schemas.xxx.com/bb/xxx.xsd" xmlns:cbe="http://xml-schemas.xxx.com/bb/xxx.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xml-schemas.xxx.com/bb/xxx.xsd xxx.xsd"> <cbe:request-header user-id="mde" session-token="433" audit-id="9999" pearl-code="ca" interface-id="mf" system-name="sr" function-code="image" /> <fde-parms function-code='b' sccf-serial='042463452400' type-process='H'> </fde-parms> </fde-request>\[/code\]and i need below output xml by copying attribute to new element values\[code\] <?xml version='1.0' encoding='UTF-8'?> <fde-request xmlns="http://xml-schemas.xxx.com/bb/xxx.xsd" xmlns:cbe="http://xml-schemas.xxx.com/bb/xxx.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xml-schemas.xxx.com/bb/xxx.xsd xxx.xsd"> <REQUEST-HEADER> <REQUEST-ID>mde</REQUEST-ID> <REQUEST-PEACODE>ca</REQUEST-PEACODE> </REQUEST-HEADER> <fde-parms function-code='b' sccf-serial='042463452400' type-process='H'> </fde-parms> </fde-request>\[/code\]but i am getting below output xml with below xslt. \[code\] <xsl:template match="@*|node()"> <xsl:copy> <xsl:apply-templates /> </xsl:copy> </xsl:template> <xsl:template match="*[local-name(.)='request-header']"> <xsl:variable name="sysname" select="@system-name"/> <xsl:variable name="peacode" select="@pearl-code"/> <REQUEST-HEADER> <REQUEST-ID><xsl:value-of select="$sysname"/></REQUEST-ID> <REQUEST-PEACODE><xsl:value-of select="$peacode"/></REQUEST-PEACODE> </REQUEST-HEADER> </xsl:template> </xsl:stylesheet>\[/code\]wrong output getting. if u see xmlns="" is populating which i do not want\[code\] <?xml version='1.0' encoding='UTF-8'?> <fde-request xmlns="http://xml-schemas.xxx.com/bb/xxx.xsd" xmlns:cbe="http://xml-schemas.xxx.com/bb/xxx.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xml-schemas.xxx.com/bb/xxx.xsd xxx.xsd"> <REQUEST-HEADER **xmlns=""**> <REQUEST-ID>mde</REQUEST-ID> <REQUEST-PEACODE>ca</REQUEST-PEACODE> </REQUEST-HEADER> <fde-parms function-code='b' sccf-serial='042463452400' type-process='H'> </fde-parms> </fde-request>\[/code\]I need to remove unnecessary empty namespace. Please help me.I appriciate your help here.