Is it possible to match only the first occurrence of a value in an XML doc using XSL transforms?
I'd like to print out every value inside f2 but only the first instance of the contents of f1.
XML Data
<doc>
<datum>
<f1>A</f1>
<f2>Monday</f2>
</datum>
<datum>
<f1>A</f1>
<f2>Tuesday</f2>
</datum>
<datum>
<f1>B</f1>
<f2>Wednesday</f2>
</datum>
</doc>
Output
A
-Monday
-Tuesday
B
-Wednesday
I. This is the well-known Muenchian Grouping method for XSLT 1.0:
when this transformation is applied on the provided XML document:
the wanted, correct result is produced:
II. XSLT 2.0 solution, using
xsl:for-each-group