Is there a way to generate the expressions for select

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.
0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact