我有以下 XML:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<Export channel="XXX" date_stamp="20130113 01:01:01">
<Script show_code="ALR" script_no="13081300" duration="1">
<Product skn="222363" />
<Product skn="203092" />
<Product skn="219585" />
<Product skn="201371" />
<Product skn="201029" />
<Product skn="202648" />
<Product skn="201294" />
<Product skn="201370" />
</Script>
<Script show_code="BQV" script_no="13081301" duration="1">
<Product skn="400063" />
<Product skn="203089" />
<Product skn="212059" />
<Product skn="202770" />
<Product skn="400292" />
<Product skn="400108" />
<Product skn="400407" />
</Script>
</Export>
我想将 Product @skn 值输出(以简单的文本格式)作为逗号分隔的实体。我当前的 XSLT 是..
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" version="1.0" encoding="utf-8" indent="no" media-type="text/xml" />
<xsl:template match="/">
<xsl:for-each select="/EPGExport/Script">
<xsl:value-of select="substring(@script_no,5,2)"/>/<xsl:value-of select="substring(@script_no,3,2)"/>/20<xsl:value-of select="substring(@script_no,1,2)"/><xsl:text>	</xsl:text>
<xsl:value-of select="substring(@script_no,7,2)"/>:00<xsl:text>	</xsl:text>
<xsl:value-of select="@show_code"/><xsl:text>	</xsl:text>
<xsl:value-of select="Product/@skn"/><xsl:text> </xsl:text>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
这将输出为:
13/08/2013 00:00 ALR 222363
13/08/2013 01:00 BQV 400063
但我希望最后一个制表符分隔值输出为:
13/08/2013 00:00 ALR 222363,203092,219585,201371,201029,202648,201294,201370
13/08/2013 01:00 BQV 400063,203089,212059,202770,400292,400108,400407
非常感谢任何帮助。谢谢。