如何替换 XSLT 中的选定字符



我正在处理一个XML文件,如下所示

<?xml version="1.0" encoding="UTF-8"?>
<Properties>
    <Property>
        <Name>Email</Name>
        <Value>alebbb@hotmail.com</Value>
    </Property>
    <Property>
        <Name>Resposta</Name>
        <Value>here "i" have ; to be"" replace by nothing</Value>
    </Property>
    <Property>
        <Name>NPS</Name>
        <Value>8</Value>
    </Property>
</Properties>

我的地图 XSLT 是这样的:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
  <xsl:output method="text" omit-xml-declaration="yes" indent="no"/>
  <xsl:strip-space elements="*"/>
    <xsl:template match="Properties">
       <xsl:variable name="Email" select="/Properties/Property[1]/Value/text()"/>
       <xsl:variable name="Resposta" select="/Properties/Property[2]/Value/text()"/>
       <xsl:variable name="NPS" select="/Properties/Property[3]/Value/text()"/>
       <xsl:value-of select="normalize-space($Email)"/>;<xsl:value-of select="normalize-space($Resposta)"/>;<xsl:value-of select="normalize-space($NPS)"/>
    </xsl:template>
</xsl:stylesheet>

如何在 XSLT 映射中使用替换来替换;"""
我得到了:

here "i" have ; to be"" replace by nothing

预期:

here i have  to be replaced by nothing

我正在使用以下内容来替换;

<xsl:value-of select="normalize-space(translate($Resposta,';',' '))"/>

给定:

<Value>here "i" have ; to be"" replace by nothing</Value>

说明:

<xsl:value-of select="normalize-space(translate(Value, ';&quot;', ''))"/>

将返回:

here i have to be replace by nothing

演示:https://xsltfiddle.liberty-development.net/ncdD7mt

最新更新