我正在尝试转换以下 XML:
<entities xmlns="http://ws.wso2.org/dataservice"><entityIds>
137651b03d18c0efee947f8bda341fb1
</entityIds>
<entityIds>
aa88ce76d454a0135c89bfbd4def62cd
</entityIds>
</entities>
使用以下 XSL
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:p="http://ws.wso2.org/dataservice">
<xsl:output method="xml" encoding="utf-8" indent="yes"/>
<xsl:template match="/">
<urlDetails>
<customerId>
<xsl:value-of select="//p:entityList/p:entity[1]/p:customerId" />
</customerId>
<entityIds>
<xsl:apply-templates/>
<xsl:for-each select="//p:entityList/p:entity">
<xsl:value-of select="p:entityId" />,
</xsl:for-each>
</entityIds>
</urlDetails>
</xsl:template>
</xsl:stylesheet>
我得到如下输出:
<?xml version="1.0" encoding="utf-8"?>
<urlDetails xmlns:p="http://ws.wso2.org/dataservice">
<customerId/>
<entityIds>
137651b03d18c0efee947f8bda341fb1
aa88ce76d454a0135c89bfbd4def62cd
</entityIds>
</urlDetails>
如何以逗号分隔输出,例如:
<?xml version="1.0" encoding="utf-8"?>
<urlDetails xmlns:p="http://ws.wso2.org/dataservice">
<customerId/>
<entityIds>
137651b03d18c0efee947f8bda341fb1 ,
aa88ce76d454a0135c89bfbd4def62cd
</entityIds>
</urlDetails>
我使用了字符串 concat 并使用 version2.0 我使用了值分隔符,两者都不起作用。还有其他首选技术吗?