To retrieve the position of an element that is between specific other elements, you can use the "count" and "preceding-sibling" functions in XSLT.
For example, if you want to retrieve the position of an "item" element that is between two "category" elements, you can use the following XSLT expression:
count(preceding-sibling::category) + 1
This expression counts the number of "category" elements that come before the current "item" element, and then adds 1 to the count to get the position of the current "item" element.
Assuming you have the following XML structure:
<root>
<category>Category 1</category>
<item>Item 1.1</item>
<item>Item 1.2</item>
<category>Category 2</category>
<item>Item 2.1</item>
<item>Item 2.2</item>
<item>Item 2.3</item>
</root>
If you apply the above XSLT expression to each "item" element, you will get the following positions:
Asked: 2023-05-04 20:10:43 +0000
Seen: 8 times
Last updated: May 04 '23