我正在处理类似
的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映射上使用replace完全替换;
和"
和""
?
我得到了:
here "i" have ; to be"" replace by nothing
预期:
here i have to be replaced by nothing
我正在使用以下内容代替;
:
<xsl:value-of select="normalize-space(translate($Resposta,';',' '))"/>
答案 0 :(得分:2)
给出:
<Value>here "i" have ; to be"" replace by nothing</Value>
说明:
<xsl:value-of select="normalize-space(translate(Value, ';"', ''))"/>
将返回:
here i have to be replace by nothing