(.Net framework version 1.1.4322)
The following XSL test case is rejected by System.Xml.Xsl.XslTransform, with an XsltException: "($dummy)+0 is an invalid XPath expression." If you remove the parentheses then it is happy. This appears to be an error; see http://www.w3.org/TR/xpath#NT-Expr. The path through the grammar is quite long; if you start with the Expr rule, it (eventually) leads back to PrimaryExpr, which indicates that ($variable) is allowed.
http://www.w3.org/TR/xpath#NT-Expr
http://www.w3.org/TR/xpath#NT-OrExpr
http://www.w3.org/TR/xpath#NT-AndExpr
http://www.w3.org/TR/xpath#NT-EqualityExpr
http://www.w3.org/TR/xpath#NT-RelationalExpr
http://www.w3.org/TR/xpath#NT-AdditiveExpr
http://www.w3.org/TR/xpath#NT-MultiplicativeExpr
http://www.w3.org/TR/xpath#NT-UnaryExpr
http://www.w3.org/TR/xpath#NT-UnionExpr
http://www.w3.org/TR/xpath#NT-PathExpr
http://www.w3.org/TR/xpath#NT-FilterExpr
http://www.w3.org/TR/xpath#NT-PrimaryExpr
-- at this point we can choose parentheses "( Expr )" or VariableReference:
http://www.w3.org/TR/xpath#NT-VariableReference
Is this fixed in a newer version of the framework? If so, where can I get the fix?
Thanks,
Alistair.
-------------------------------------------
test case (run it over any XML document; mine is just "<a/>")
-------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" indent="yes"/>
<xsl:variable name="dummy">
<xsl:value-of select="132"/>
</xsl:variable>
<xsl:template match="/">
<myitem>
<xsl:attribute name="number">
<xsl:value-of select="($dummy)"/>
</xsl:attribute>
</myitem>
</xsl:template>
</xsl:stylesheet>