谁能告诉我从下面的XML中获得输出"LIVE|Customer is active“所需的XSLT是什么?我以为我从另一篇文章中得到了答案,但事实并非如此。
<?xml version="1.0"?>
<cns:customer xmlns:cns="https://services.cns.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://services.cns.com docs/xsd/customer.xsd">
<cns:userId>1001</cns:userId>
<cns:status>LIVE</cns:status>
<cns:statusMessage>Customer is active</cns:statusMessage>
<cns:type wholesale="true" suspended="false">W1</cns:type>
<cns:properties>
<cns:property>
<cns:name>Name</cns:name>
<cns:value>Bob</cns:value>
</cns:property>
</cns:properties>
</cns:customer>谢谢,
保罗
发布于 2012-05-22 03:07:01
如果只想将XML转换为问题中提到的字符串,可以使用以下样式表:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:cns="https://services.cns.com">
<xsl:output method="text"/>
<xsl:template match="/*">
<xsl:value-of select="concat(cns:status,'|',cns:statusMessage)"/>
</xsl:template>
</xsl:stylesheet>https://stackoverflow.com/questions/10691020
复制相似问题