Rod
Rod

Reputation: 15455

xsl transform generating xsl stylesheet in a .net environment

What xsl do I need to use myVar1 variable inside myVar2? I'm using an xsl transform to produce the new stylesheet.

    <xsl:element name="variable"><xsl:attribute name="myVar1">test value</xsl:attribute> </xsl:element>

    <xsl:element name="variable">
      <xsl:attribute name="myVar2" />
      <xsl:element name="xsl:value-of">
        <xsl:attribute name="select">
          /root/child[@myattr1='$myVar1']/@value      <!--Help here-->
        </xsl:attribute>
      </xsl:element>
    </xsl:element>
  </xsl:template>

Upvotes: 1

Views: 36

Answers (1)

Stefan Hegny
Stefan Hegny

Reputation: 2187

I think you mean

<xsl:attribute name="select">
  <xsl:value-of select="concat('/root/child[@myattr1=',$myVar1,']/@value')"/>
</xsl:attribute>

Upvotes: 2

Related Questions