.[nodeTest] expression doesn't work
xsl:apply-templates select=".[nodeTest]" mode="somemode"
fails with could not compile select expression
.
I've re-read "Abbreviated Syntax" chapter in the specification 开发者_运维技巧and still don't understand if it's an implementation bug or an appropriate behavior.
self::node[nodeTest]
of course works well.
Is it somehow specified that shortened self axis shouldn't work with predicate?
Is it somehow specified that shortened self axis shouldn't work with predicate?
Yes, this is determined by the grammar rules of XPath:
[20] FilterExpr ::= PrimaryExpr
| FilterExpr Predicate
[15] PrimaryExpr ::= VariableReference
| '(' Expr ')'
| Literal
| Number
| FunctionCall
As can be seen from these, PrimaryExpr
cannot be .
.
This syntactic omission was corrected in XPath 2.0, where the expression .[someCondition]
is perfectly legal.
精彩评论