2
以下是<Validation>
標記可以有標記的1 .... n的XML。通過XSLT操縱XML值
<Header>
...
...
</Header>
<Validation>
<Type>Classic</Type>
<Percentage>10</sPercentage>
<Failed>
<ID>CS-20192018</ID>
<Department>MF404</Department>
<ErrorDescription>Failed at server</ErrorDescription>
</Failed>
<Failed>
<ID>CS-3233333</ID>
<Department>MF404</Department>
<ErrorDescription>Failed at webservice</ErrorDescription>
</Failed>
</Validation>
<Validation>
<Type>CheckMember</Type>
<Percentage>20</Percentage>
<Failed>
<ID>CS-4648902</ID>
<Department>MF404</Department>
<ErrorDescription>Data not available</ErrorDescription>
</Failed>
</Validation>
要求:
我只是想總結基礎上,<Failed>
數的百分比。
首先<Validation>
標籤:
Percentage * no of <Failed> count = Result1
10 * 2 = 20
二<Validation>
標籤:
Percentage * no of <Failed> count = Result2
20 * 1 = 20
Total = Result1 + Result2 = 20 + 20 = 40
因此,我想總百分比輸出爲40,我試着用xsl:call-template
的方法,但它都吹了。
您能否與我分享代碼片段來計算百分比總和?