Thank you once again Mr. Kay. I have re-worked the build template to include your solution
Code:
<xsl:template name="build">
<xsl:variable name="modes" select="(xs:QName('CSV'), xs:QName('XML'), xs:QName('HTML'))" as="xs:QName+"/>
<xsl:for-each select="(1, 2, 4)">
<xsl:variable name="pos" select="position()"/>
<xsl:variable name="mode" select="$modes[$pos]" as="xs:QName"/>
<xsl:if test="(floor($types div .) mod 2 = 1)">
<xsl:message select="'Selected format : ', $mode"/>
<xsl:apply-templates select="$root" mode="{$mode}"/>
</xsl:if>
</xsl:for-each>
</xsl:template>
and when applicable I get an xsl:message to the console listing my selection. However, I am still unable to make the mode attribute of the xsl:apply-templates dynamic using this approach. Is it even possible?
I have tried various options here but regardless Oxygen (Saxon-PE 9.4.0.4) tells me that the value used is not a valid QName, so I am beginning to think that this approach simply will not work.
I know it's not the end of the world but it is my preferred solution and I would have liked to have had it working.
Can anyone tell me if making this attribute's value dynamic is possible?
--
William