简体   繁体   English

如何在XSLT中调用Umbraco词典项?

[英]How to call to an Umbraco dictionary item in XSLT?

I'm working on an Umbraco site which mostly uses .cshtml files, but for a couple small places, they use .xslt files to handle embedding videos. 我正在一个Umbraco网站上工作,该网站主要使用.cshtml文件,但是在几个小地方,他们使用.xslt文件来处理嵌入视频。 I don't know a thing about .xslt. 我对.xslt一无所知。 But, through my googling, I've figured out what I need to put to call to a dictionary item (which will replace hard-coded text). 但是,通过谷歌搜索,我已经知道需要调用什么来调用字典项(它将替换硬编码的文本)。

<p>umbraco.library:GetDictionaryItem("NameOfDictionaryItem")</p>

My question is, do I need to wrap this code in something like this: 我的问题是,我是否需要将此代码包装成如下形式:

<xsl:blahblah>
  <p>umbraco.library:GetDictionaryItem("NameOfDictionaryItem")</p>
</xsl>

I can show the code of the whole file if need be... Just don't know how much of it is relevant. 如果需要,我可以显示整个文件的代码...只是不知道其中有多少是相关的。

为了从字典项中选择值,您需要使用xsl:value-of函数:

<p><xsl:value-of select="umbraco.library:GetDictionaryItem('NoNewsArticles')" /></p>

我找到了执行此操作的正确方法:

<p><xsl:value-of select="umbraco.library:GetDictionaryItem('NameOfDictionaryItem')" /></p>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM