什么是XSLT中的?

use*_*160 7 xslt xpath

什么是//XSLT?(例如$currentPage//node)

Dim*_*hev 8

什么//在xslt?例如($ currentPage // node)

在XPath中的缩写:

// 是的缩写 /descendant-or-self::node()/

xslt指令的某些属性(例如select属性)的值必须是XPath表达式.

因此,

($currentPage//node)
Run Code Online (Sandbox Code Playgroud)

代表

($currentPage/descendant-or-self::node()/node)
Run Code Online (Sandbox Code Playgroud)

这将选择所有名称node为节点子节点的元素,这些节点包含在变量中,$currentPage或者是变量中包含的节点的后代$currentPage.

请注意,在提供的表达式中node()节点测试(它选择descendant-or-self::轴上的所有节点类型,例如元素,文本节点,注释和处理指令.

另一方面,它somePath/node是一个简写somePath/child::node,仅选择命名node为上下文节点的子元素的元素.

我强烈建议不要使用node元素名称以避免这种混淆.