“Could not get the type info from component xml schema” when loading a page in SiteEdit 2009

我的梦境 提交于 2020-01-03 20:58:43

问题


I enabled inline editing on SitEdit 2009 SP2 using the answer given here

How do I enable inline field editing in SiteEdit when using an XSLT TBB?

but I keep getting this error when loading the resulting page in SiteEdit:

Sys.FormatException: Could not get the type info from component xml schema. Field: cf_tcm:20-33457-64_content_header XPath: [1]

My XSLT TBB fragment:

<xsl:if test="//*[local-name()='content_header'] != ''">
    <h1>
        <div>
            <tcdl:ComponentField name="content_header" index="0">
                <xsl:value-of select="//*[local-name()='content_header']">
            </tcdl:ComponentField>
        </div>
    </h1>
</xsl:if>

The output in the published file:

<h1>
  <div>
    <span>
      <!-- Start SiteEdit Component Field: {"ID" : "cf_tcm:20-33457-64_content_header", "XPath" : "[1]", "IsMultiValued" : false} -->
      <tcdl:ComponentField name="content_header" index="0" SiteEditProcessed="true">
        Test
      </tcdl:ComponentField>
    </span>
  </div>
</h1>

What is wrong with my code?


回答1:


That error message means that the XPath in your <!-- Start SiteEdit Component Field: { ...} --> command does not point to a field in the current Component. Given that your XPath shows up as [1], that sounds pretty accurate.

You'll need to find the cause of the empty XPath being output. In your XSLT you mark the field with a <tcdl:ComponentField> wrapper. This wrapper is later processed by the "Enable Inline Editing" TBB to generate a corresponding <!-- Start SiteEdit Component Field ... --> command. Since the SiteEdit front-end needs an XPath to the field and the tcdl:ComponentField only contains the field name, the TBB will need to look up the XPath based on the field name.

The "Enable Inline Editing" TBB from SiteEdit 2009 looks up the current Component when processing tcdl:ComponentField by looking at the current resolved item (engine.PublishingContext.ResolvedItem.Item.Id). It then looks up the field in that Component to determine its XPath.

If you look at the package in the Template Builder, what is the Component at the bottom of the Package list? Does that Component contain a content_header field?



来源:https://stackoverflow.com/questions/10436067/could-not-get-the-type-info-from-component-xml-schema-when-loading-a-page-in-s

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!