2017-08-24 24 views
0

試圖刪除^M。我不確定這是可以通過XSLT完成還是退步。如何使用XSLT 1.0刪除特殊字符^ M

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" >^M 
    <soapenv:Header>^M 

    </soapenv:Header>^M 
    <soapenv:Body>^M 
     <urn:getTargetingInfo>^M 
      <getTargetingInfoRequest>^M 
       <inCID>202020</inCID>^M  
       <inAttributeType/>^M 
      </getTargetingInfoRequest>^M 
     </urn:getTargetingInfo>^M 
    </soapenv:Body> 
</soapenv:Envelope> 
+0

這不是一個良好的XML:在'urn'前綴未綁定到一個命名空間URI。 –

回答

0

嘗試:

XSLT 1.0

<xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> 
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/> 
<xsl:strip-space elements="*"/> 

<!-- identity transform --> 
<xsl:template match="@*|node()"> 
    <xsl:copy> 
     <xsl:apply-templates select="@*|node()"/> 
    </xsl:copy> 
</xsl:template> 

<xsl:template match="text()[starts-with(., '^M')]"/> 

</xsl:stylesheet>