XSLT: Remove namespace prefix from elements

前端 未结 1 892
春和景丽
春和景丽 2020-12-10 21:35

I need to remove the namespace prefix from an un-SOAP\'d message.

This is the message that has had the SOAP envelope removed. As you can see it contains

相关标签:
1条回答
  • 2020-12-10 21:55

    It is called namespace, below is a code to remove namespace from all elements and attributes ..

    <?xml version="1.0" encoding="utf-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
      <xsl:output method="xml" indent="yes"/>
    
      <xsl:template match="*">
        <xsl:element name="{local-name(.)}">
          <xsl:apply-templates select="@* | node()"/>
        </xsl:element>
      </xsl:template>
      <xsl:template match="@*">
        <xsl:attribute name="{local-name(.)}">
          <xsl:value-of select="."/>
        </xsl:attribute>
      </xsl:template>
    </xsl:stylesheet>
    
    0 讨论(0)
提交回复
热议问题