This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Converting a string to node test


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:call-template>

<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()"/>
</xsl:template>

Do you know the secret?

Thanks,
Xavier.


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]