Is there a way to generate the expressions for select
Created May 4, 2012
Thomas BROYER First, always prefer templates to for-each loops when possible.
Also, be very careful with XPath object types and XPath context.
<xsl:template match="person"> <xsl:variable name="person" select="."/> <xsl:for-each select="/doc/format/field"> <variable name="field-name"> <xsl:value-of select="."/> </xsl:variable> <xsl:value-of select="$person/*[name() = $field-name]"/> </xsl:for-each> <xsl:template>Note you can use current() instead of $field-name.