Sitecore xpath查询无效

M.R*_*.R. 2 xpath sitecore sitecore6

查询1: /sitecore/content/FR/Cabinet/New Category/Attributes//*[@@TemplateID = '{95793C69-3E37-4CEB-9AF4-FD88276D85AA}']

查询2: /sitecore/content/FR/Cabinet/New Category/Child Category 1/Attributes//*[@@TemplateID = '{95793C69-3E37-4CEB-9AF4-FD88276D85AA}']

查询1工作,没有问题 - 查询2不起作用,说expected ::.有什么不同,除了一个更深层次之外./Child Category 1/事实上,实际上attributes文件夹中没有任何子项,而/New Category/Attributes...

更新 - 所以似乎"Child"是Xpath中的关键字......这里的解决方法是什么?

Der*_*ker 5

您可以通过将其包装在哈希中来转义类别:

/sitecore/content/FR/Cabinet/New Category/#Child Category 1#/ ...

选择包含空格的字段时,这也很方便:

... //*[@#My Spaced Out Field# = '%Hey Yo!%']

如果您正在动态构建查询,则可能需要考虑单独转义每个令牌,使用.AxesAPI或使用Lucene选择项目.