使用 XSLT TBB 时如何在 SiteEdit 中启用内联字段编辑? [英] How do I enable inline field editing in SiteEdit when using an XSLT TBB?

查看:22
本文介绍了使用 XSLT TBB 时如何在 SiteEdit 中启用内联字段编辑?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用来自 SDL Tridion World 和 SiteEdit 2009 SP3 的 XSLT Mediator 开发 SDL Tridion 2011 SP1.我已经创建了 XSLT TBB,并为组件模板启用了内联编辑,在页面模板中启用了 SiteEdit.我已经使用它创建了页面并发布了它.

但并未为每个字段启用 SiteEdit.当我查看页面预览的来源时,它只有一个用于整个组件的span标签.但通常如果为组件启用了 SiteEdit,我们应该为每个字段设置 span 标签.

我被困在这一点上.我已经使用 XSLT 中介器创建了 XSLT TBB.

谁能建议我们是否可以使用 XSLT TBB 在复合模板中启用 SiteEdit?如果可以的话,建议我做的步骤.

解决方案

如果您将 XSLT TBB 与 XSLT Mediator 一起使用,您将需要手动包装要为 SiteEdit 启用的字段,以便它们出现在你的模板.考虑使用类似于以下代码的 XSLT 包装您的字段:

</xsl:for-each></xsl:模板></xsl:stylesheet>

此代码循环遍历每个嵌入的段落字段,并输出文本字段值,并使用适当的 SiteEdit TCDL 语法对其进行包装.

I am working on SDL Tridion 2011 SP1 with the XSLT Mediator from SDL Tridion World and SiteEdit 2009 SP3. I have created XSLT TBB, and enabled Inline editing for Component Template, enabled SiteEdit in the Page Template. I have created the page using that and published it.

But SiteEdit is not being enabled for each field. When I looked at the source of page preview, it has only one span tag for whole component. But usually if SiteEdit is enabled for the component we should have span tag for each field.

I am stuck at this point. I have created XSLT TBB using XSLT mediator.

Can anyone suggest whether we can enable SiteEdit in a Compound Template using an XSLT TBB? If it can be done, suggest me the steps to do it.

解决方案

If you are using XSLT TBBs with the XSLT Mediator, you will need to manually wrap the fields you want to enable for SiteEdit so that they appear in the output of your template. Consider wrapping your fields with XSLT using code similar to this:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
    <xsl:template match="/">
        <xsl:for-each select="//*[local-name()='paragraph']">
            <div>
                <tcdl:ComponentField name="paragraph[{position() -1}].text" index="0">
                    <xsl:apply-templates select="./*[local-name()='text']"/>
                </tcdl:ComponentField>
            </div>
        </xsl:for-each>
    </xsl:template>
</xsl:stylesheet>

This code loops through each embedded paragraph field, and outputs the text fields value, and wraps it with the appropriate SiteEdit TCDL syntax.

这篇关于使用 XSLT TBB 时如何在 SiteEdit 中启用内联字段编辑?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆