这是我的示例 XML 看起来像
<Header>
<id> 1234 <id>
<type> abcd <type>
<account>
<code1>a11 </code1>
<code2>a12 </code2>
<expense>
<cost> 10 </cost>
<description> Travel </description>
</expense>
<expense>
<cost> 30 </cost>
<description> Travel </description>
</expense>
<expense>
<cost> 20 </cost>
<description> Hotel </description>
</expense>
<expense>
<cost> 10 </cost>
<description> Hotel </description>
</expense>
</account>
</Header>
我需要以 XML 格式显示结果,如下所示
<Header>
<id> 1234 <id>
<type> abcd <type>
<code1>a11 </code1>
<code2>a12 </code2>
<description> Travel </description>
<cost> 40 </cost> <!-- sum of cost nodes, if description is Travel -->
<description> Hotel </description>
<cost> 30 </cost> <!-- sum of cost nodes, if description is Hotel -->
</Header>
如何根据条件在 XSLT 2.0 中编写成本总和?