开发者

Nesting of xsl:key() within xsl:key() & combining results of xsl:key()

开发者 https://www.devze.com 2022-12-10 15:40 出处:网络
I have 2 unrelated questions. I need to do a grouping of data using XSLT. I need this to function like how a nested IF within an IF would function. After which, I need to group the data so that I can

I have 2 unrelated questions. I need to do a grouping of data using XSLT. I need this to function like how a nested IF within an IF would function. After which, I need to group the data so that I can split it into multiple files according to the Group condition.

Using XSLT Version 1.0 :

Q1) How do you nest a key() within another key() (i.e. Use the result nodes returne开发者_高级运维d from the first key() as current node-list to search for 2nd key() condition to group my data)?

Q2) Can I combine the results of 2 key() functions? Say, I want to execute code for all nodes with Key values of "A" and "B".

Does anyone know how to solve Q1 and Q2?

Appreciate your help very much! I hope the questions are clear enough. Let me know if you need examples of input and output.

Regards, Melita.


On Q2, did you mean "values of 'A' OR 'B'"? The key for an element has only one value.

<xsl:for-each select="key('myKey', 'A') | key('myKey', 'B')">
  ...
</xsl:for-each>
0

精彩评论

暂无评论...
验证码 换一张
取 消