开发者

.[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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜