canonical xpath problems?

2019-07-04 03:05发布

问题:

If a single dot is converted into self()::node() in xpath, Source

Then why does this work:

<xsl:value-of select="self::node()[name()='QWE']"/>

but not this?:

<xsl:value-of select=".[name()='QWE']"/>

回答1:

Because the expression

.[name()='QWE']

is illegal XPath 1.0 syntax, an abbreviated step may not contain a predicate. XPath 2.0 doesn't have this restriction.



标签: xml xslt xpath