查询符号为模板生成器中的Sitecore的

查询符号为模板生成器中的Sitecore的

本文介绍了查询符号为模板生成器中的Sitecore的“源”字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使用查询符号(或XPath - 无论工作)来设置模板的源字段,但没有人似乎工作

I am trying to set the the source field of a template using the query notation (or xpath - whichever works), but none of them seems to be working.

我的内容树是一个多站点的内容树:

My content tree is a multisite content tree:

France
--Page 1
----Page1A
-------Page1AA
--Page 2
--Page 3
--METADATA
----Regions

US
--Page 1
----Page1A
-------Page1AA
--Page 2
--Page 3
--METADATA
----Regions

每个站点都有自己的元数据文件夹,我想它,以便增加一个页面内各主要国家节点的时候,我想的值以反映无论是在该网站的元数据。我现在两个不同的领域 - 一个droplink和treelistex场。所以我想我就可以得到这是一个国家的网站上的父项,并获得元数据文件夹的。当我把在这两个领域下面的查询,我得到不同的结果:

Each site has its own METADATA folder, and I want it so that when adding a page inside each of the main country nodes, I want the values to reflect whatever is in the METADATA of that site. I have two different fields for now - a droplink and a treelistex field. So I thought I can just get the parent item that is a country site, and get the metadata folder for that. When I put the following query in both the fields, I get different results:

 query:./ancestor::*[@@templatename='CountryHome']/METADATA/Regions/*


  • 对于droplink场,我只得到第一个地区(一个项目)

  • 对于treelistex场,我得到的全部内容树

  • 我又试图修改查询一点点,并采取了'查询'标记出来

    I then tried to modify the query a little bit and took the 'query' notation out

     ./ancestor::*[@@templatename='CountryHome']/METADATA/Regions/*
    

    如果我去给开发者中心/ XPath的建设者,和上下文节点设置为国主网站下的任何项目,它返回我正是我需要的,但是当我把这个源,我得到的全部内容树两种情况。

    If I go to the developer center/xpath builder, and set the context node to any item underneath the main country site, it returns me exactly what I need, but when I put this in the source, I get the entire content tree in both the cases.

    帮助!

    推荐答案

    在这里应该与Droplink领域的工作是什么。也许你是指Droptree?

    What you have here should work with the Droplink field. Perhaps you are referring to Droptree?

    query:./ancestor::*[@@templatename='CountryHome']/METADATA/Regions/*
    

    对于TreelistEx,我不觉得默认的TreeList字段支持Sitecore的查询。但是,介绍如何创建一个支持它的自定义的TreeList。

    As for the TreelistEx, I don't think the default Treelist fields support Sitecore query. However, this article describes how to create a custom TreeList that supports it.

    这篇关于查询符号为模板生成器中的Sitecore的“源”字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-23 20:11