[xsl] Converting a string to node test

Subject: [xsl] Converting a string to node test
From: Xavier Cazin <cazinx@xxxxxxxxx>
Date: 21 Apr 2001 11:49:33 +0200
Hi everyone,

I have crafted a template for a specific situation, and I'd like to make it
more generic. It involves a node test that should entirely depend on
variables and param. But the left member of the node test doesn't want to
be made less static:

<xsl:call-template name="generic">
  <xsl:with-param name="x" select="my-element"/>
  <xsl:with-param name="y" select="'my-attrib-name'"/>

<xsl:template name="generic">
  <xsl:param name="x"/>
  <xsl:param name="y"/>
  <xsl:variable name="z" select="'my attribute value'"/>
  <!-- This line works -->
  <xsl:copy-of select="$x[@my-attrib-name=$z]/node()"/>
  <!-- This line doesn't, nor any line of that kind I've tried... -->
  <xsl:copy-of select="$x[@$y=$z]/node()"/>

Do you know the secret?


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Current Thread