如何使用XSLT 1.0删除特殊字符^ M.

时间:2017-08-24 15:24:53

标签: xslt

尝试删除<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> 。我不确定这是否可以通过XSLT或回归来完成。

import matplotlib.pyplot as plt
import numpy as np
import pandas as pd

csv = pd.read_csv('F:\Python\Delete\Delete.csv')

age = csv.age
gender = csv.gender

new_age = age[~np.isnan(age)]
new_age_f = new_age[gender==2]
new_age_m = new_age[gender==1]

plt.hist(new_age_f, alpha=.80, label='Female', width=1, align='left')
plt.hist(new_age_m, alpha=.80, label='Male', width=1, align='left')

plt.legend()

plt.show()

1 个答案:

答案 0 :(得分: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>