0
我有一個XML如:如何獲取XSL中的重複值?
<Response xmlns="www.google.com">
<Result>
<Errors xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<a:string>1sterror</a:string>
<a:string>another error</a:string>
</Errors>
</Result>
</Response>
我想一個輸出中類似如下:
<?xml version="1.0" encoding="UTF-8"?>
<pagedata xmlns:aa="www.google.com"
xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<test>1sterror</test>
<test>another error</test>
</pagedata>
,我想提出的XSL是:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:aa="www.google.com"
xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<xsl:output method="xml" indent="yes" />
<xsl:template match="aa:Response">
<xsl:apply-templates select="aa:Result" />
</xsl:template>
<xsl:template match="aa:Result">
<pagedata>
<xsl:apply-templates select="aa:Errors"/>
</pagedata>
</xsl:template>
<xsl:template match="aa:Errors">
<xsl:apply-templates select="a:string"/>
</xsl:template>
<xsl:template match="a:string">
<test>
<xsl:value-of select="a:string"/>
</test>
</xsl:template>
</xsl:stylesheet>
但我得到的輸出是:
<?xml version="1.0" encoding="UTF-8"?>
<pagedata xmlns:aa="www.google.com"
xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<test/>
<test/>
</pagedata>
這是沒有數據。誰能幫忙?
愚蠢的錯誤。說得通! – Chandeep