开发者

Left Section Menu - Retraive Items in Sitecore

I have the following XSLT Section Menu Code which working correctly to retreive items. But I'd like to replaced the items query by items name how ?

 <!--<xsl:if test="contains($EnabledTemplates, concat('!', @template, '!')) ">-->
    <xsl:for-each select="$root/item[contains($EnabledTemplates, concat('!', @template, '!'))]">
      <xsl:sort select="@sortorder" data-type="number" />
      <xsl:variable name="IsHaveChild" select="boolean(./item)" />
      <xsl:variable name="IsSelected" select="boolean(./desc开发者_运维知识库endant-or-self::item[@id=$sc_currentitem/@id])" />
      <xsl:variable name="IsShow" select="boolean(sc:fld($IsHideFieldName,.)!=1)" />
      <xsl:variable name="IsCurrent" select="boolean(@id=$sc_currentitem/@id)" />
      <sc:sec />


Do you want to filter items by name?

Try something like this:

[contains(@name, 'some text')]


For your querying you can choose between XPath and Sitecore query. The latter is a Sitecore implementation of XPath which is more readable and allows you to use the item names instead of XPath syntax.

Sitecore query however cannot be put directly in a select attribute in your XSL elements, it only works in the Sitecore XSL helper functions like sc:item (please also not the . in the sc:item function to specify the context item in which the query needs to be applied, . stands for current item).

<!-- using XPath -->
<xsl:value-of select="/item[@key='sitecore']/item[@key='content']" />

<!-- using Sitecore query -->
<xsl:value-of select="sc:item('/sitecore/content', .)" />
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜