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?
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?