此代码选择节点,我想处理......:

<xsl:variable name="rootTextpageNode" 
     select="$currentPage/ancestor-or-self::node [@level = 2 and
             @nodeTypeAlias = 'CWS_Textpage']" />

如何在那里放置排序/订单,所以首先显示带有较新createdDate的项目?

我正在使用CWS入门套件,需要更改SubNavi.xslt中显示的项目的顺序

有帮助吗?

解决方案

您可以在for-each之后的第一行进行排序,如下所示:

<xsl:for-each select="$rootTextpageNode">
<xsl:sort select="@createDate" order="descending" />
    <xsl:value-of select="@nodeName" />
</xsl:for-each>

其他提示

不确定是否可以为此变量赋值添加排序 - 通常,您在应用模板时或在执行foreach时进行排序:

<xsl:template match="employees">
    <xsl:apply-templates>
      <xsl:sort select="salary"/>
    </xsl:apply-templates>
  </xsl:template>

<xsl:for-each select="catalog/cd">
  <xsl:sort select="artist"/>
  <tr>
    <td><xsl:value-of select="title"/></td>
    <td><xsl:value-of select="artist"/></td>
  </tr>
</xsl:for-each>

请参阅排序XSLT 在哪里放置排序信息

马克

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top