从tcm检索URL

时间:2012-10-26 08:58:29

标签: xslt webforms tridion

我正在尝试在渲染xslt中检索多媒体组件的URL,但它仍然失败。

我可以拿起tcm URI。有没有办法从中获取URL?

我尝试使用tcmse:PublishBinary函数,但失败并显示错误“Namespace'http://www.tridion.com/ContentManager/5.1/TcmScriptAssistant'不包含任何函数。”

<table cellspacing="0px" cellpadding="0px" style="border: 0; padding: 0px; width: 100%"> 
    <xsl:for-each select="twf:items/twf:item">
        <tr>
            <td colspan="2">
                <!-- <xsl:value-of select="twf:webformscomponentlink/@xlink:href" /> -->
                <!-- <xsl:value-of select="tcmse:PublishBinary(string(twf:webformscomponentlink/@xlink:href))" /> -->
                <span>
                    <xsl:call-template name="replace-new-lines">
                        <xsl:with-param name="string">
                            <xsl:value-of select="twf:linklabel" />
                        </xsl:with-param>
                    </xsl:call-template>
                    <xsl:text> </xsl:text>
                </span>
                <xsl:element name="a">
                    <xsl:attribute name="href">
                        <xsl:choose>
                            <xsl:when test="twf:webformscomponentlink/@xlink:href">
                                <xsl:value-of select="twf:webformscomponentlink/@xlink:href" /> 
                            </xsl:when>
                            <xsl:otherwise>#</xsl:otherwise>
                        </xsl:choose>
                    </xsl:attribute>
                    <xsl:value-of select="twf:linktext" />
                </xsl:element>    
            </td>
        </tr>
    </xsl:for-each>
</table> 

非常感谢

1 个答案:

答案 0 :(得分:1)

您提到您正在尝试在Render XSLT中解析多媒体组件,并且在您的标签中我看到WebForms,因此我假设它是SDL Tridion WebForms组件模板的Render XSLT。

WebForm是一个动态组件表示,它的组件模板使用两个XSLT,一个在Source选项卡(Expand XSLT)中,当发布者在CMS上呈现模板代码时,它在发布时执行。动态模板是另一个,它包含一个XSLT,它在发布时被复制到Content Broker。在WebForms组件演示的请求时,动态模板用于将Expand XML转换为WebForm。

因为动态模板是在请求时执行的,此时TcmScriptAssistant不再可用(它仅在发布时存在于Content Manager端)。解决方案是使用tcmse:PublishBinary()在展开模板中解析多媒体组件,在渲染模板中,您只能转换/显示扩展模板的结果,但您无法访问CM功能点。