This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Converting a string to node test
- To: xsl-list at lists dot mulberrytech dot com
- Subject: [xsl] Converting a string to node test
- From: Xavier Cazin <cazinx at online dot fr>
- Date: 21 Apr 2001 11:49:33 +0200
- Reply-To: xsl-list at lists dot mulberrytech dot com
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