In XSL 2.0, I'm trying to iterate through some data by the distinct values, and then do something with them.
<xsl:for-each select="distinct-values(InvoiceLine/Service/ServiceMnemonicCode)">
<xsl:variable name="mnemonic">
<xsl:value-of select="."/>
</xsl:variable>
<fo:table-row>
<fo:table-cell>
<fo:block>
<xsl:value-of select="InvoiceLine/Service[ServiceMnemonic=$mnemonic]/ServiceDescription"/>
</fo:block>
</fo:table-cell>
</fo:table-row>
</xsl:for-each>
However I end up with the following error:
XPTY0020: Axis step
child::element({http://schemas.blabla.com/etp/invoice/types}InvoiceLine, xs:anyType)
cannot be used here: the context item is an atomic value
ailed to compile stylesheet. 1 error detected.
I've bee googling furiously, and I do see people complaining about "atomic values" but I haven't seen anyone suggest what to do about it. I've using Saxon9. Any insight would be greatly appreciated.