In-context editing enabled components

If you want your users to in-context edit the text  on the component, it is relatively easy to do.

Say we have a component with 2 datum elements.

<Datum ID="author" Type="String" Name="Author">John Doe</Datum>
<Datum ID="article" Type="DCR" Name="News Article">
 <DCR Category="acme" Type="news">templatedata/acme/news/data/helloworld</DCR>

You need to pass SitePublisher the ID of the datum element to edit. Note the squigly brackets {}.

<span in-context-edit="{/Properties/Data/Datum[@ID='author']/@ID}">
    <xsl:value-of select="/Properties/Data/Datum[@ID='author']" />

If the element is a DCR and you want the user to edit the DCR’s content (say the article title), you need to supply the FormsPublisher path of the item in the DCR (in my case /article/title – it’s just incidcental that it maches my xpath [I tell a lie. I chose the name and the location of the title to be the same for exactly this kind of reason]). We pass that value to the attribute dcr-item-paths attribute.

<span in-context-edit="{/Properties/Data/Datum[@ID='article']/@ID}" dcr-item-paths="/article/title">
    <xsl:value-of select="/Properties/Data/Datum[@ID='article']/DCR/article/title" />

If you switch  the view to in-context edit, the page parts which cannot be edited are greyed out, the others are white. Hovering colors them (?) purple and clicking on them will open a little overlay where the user can edit the text directly. It’s like magic.



  1. Hi Laurent, I tried using comma separated paths but no success. Here is my example below.






    My component

    Single /Root/Content/Path works but comma separated /Root/Content/Path,/Root/Content/Height did not work.
    Where do you think my mistake?
    I appreciate your help. Thanks a lot.
    Oleg D

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s