<Categories>
<cat>Video</cat>
<cat>Audio</cat>
<cat>Hybrid</cat>
</Categories>
这个类别可以在查找XML中使用映射,像这样:
<Lookup>
<cat>Video</cat>
<mapping>1</mapping>
</Lookup>
<Lookup>
<cat>Audio</cat>
<mapping>2</mapping>
</Lookup>
<Lookup>
<cat>Hybrid</cat>
<mapping>3</mapping>
</Lookup>
</ValueSet>
现在我正在寻找一个XSLT解决方案,该解决方案可以在不使用节点集扩展函数的情况下将最大值作为转换的输出结果返回。
以下是我的测试用例:
测试用例1:
输入:
<Categories>
<cat>Video</cat>
<cat>Audio</cat>
<cat>Hybrid</cat>
</Categories>
"Expected Output 3"
"测试用例2:"
"输入: "
<Categories>
<cat>Video</cat>
<cat>Hybrid</cat>
</Categories>
Expected Output 3
Test case 3 :
Input :
<Categories>
<cat>Video</cat>
<cat>Audio</cat>
</Categories>
Expected Output 2
Test case 4 :
Input :
<Categories>
<cat>Audio</cat>
<cat>Hybrid</cat>
</Categories>
Expected Output 3
Test case 5 :
Input :
<Categories>
<cat>Video</cat>
</Categories>
预期输出1
提前感谢。
评论更新:
Lookup information for me is not available to load [with
document()
function]. I need to dofor-each
on the categories input and then derive the lookup value. After that , I need to get the maximum.I have an extension available from xsl engine processor to get this with in xslt like below:
<xsl:value-of select='xx:lookupValue("MappingXML","Category",.,"COL1")'/>
This function returns string. This function doesn't return nodeset. I tried with variable by capturing all the derived values after executing
for-each
, but to process further this variable output (RTF), in XSLt 1.0, i have no handle on any node-set() functions.