xslt-2.0 - 如何删除与属性关联的 Soap 命名空间
问题描述
我必须删除与 ConfigR(属性)关联的肥皂名称空间。
在 XSLT 内部,我使用的是 XSL Copy,因此排除前缀不起作用。
我在下面尝试过,但没有工作。请任何人建议。
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" >
<xsl:output indent="yes"/>
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="soapenv:*">
<xsl:apply-templates select="@* | node()"/>
</xsl:template>
</xsl:stylesheet>
输入 -
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<ConfigR>
Inside I have some more input.
</ConfigR>
</soapenv:Body>
</soapenv:Envelope>
Now in Output I am getting:
<ConfigR xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
解决方案
您可以替换现有模板:
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()" />
</xsl:copy>
</xsl:template>
有以下内容:
<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>
你可以在这里找到
推荐阅读
- struct - Rust 哪些数据包含一个已分配结构的变量
- python - 如何在 Dense 或 Flatten 层之后应用 Conv1D:ValueError:形状 (1, 1, 3) 和 (1, 1) 不兼容
- node.js - 此处理程序的正确类型是什么
- informatica - 如何在值中添加缺失的字符
- html - CSS避免ul列表项浮动到框
- php - PHP 中的图像库
- javascript - Javascript if 语句或运算符不起作用
- apify - 使用apifycheerio,apify基本爬虫可以达到多少RPS(每秒请求)
- reactjs - TypeScript React,无法向组件发送道具
- hadoop - HIVE:执行错误,从 org.apache.hadoop.hive.ql.exec.mr.MapRedTask 返回代码 2