3

我想即时修改内容,以便稍后将修改后的版本输入主题的内容槽。用例将日历portlet 定位在collective.cover 行/列/单元格中。

这是我尝试过的:

<replace css:content="#content .row:nth-child(2) .cell:nth-child(2) .tile.tile-edge">

  <!-- These work (meaning levels above current selection CAN be copied) -->
  <xsl:copy-of select="." />
  <xsl:copy-of select="../.." />
  <xsl:copy-of select="/" />

  <!-- However, neither of these do -->
  <xsl:copy-of css:select=".portletCalendar:first-child" />
  <xsl:copy-of select="//div[contains(concat(' ', normalize-space(@class), ' '), ' portletCalendar ')]" />
  <xsl:copy-of select="//div[@id='portal-personaltools']" />

</replace>
4

1 回答 1

3

可能您遇到的唯一问题是依赖 Diazo 的工具来翻译 XSL 命令中的 css 选择器。仅当目标是当前选定的节点或其子节点时才有效。因此,将其替换为 XPath 选择器:

<!-- replace one part of content with another -->
<replace css:content="#content .row:nth-child(2) .cell:nth-child(2) .tile.tile-edge">
  <xsl:copy-of select="//dl[@class='portlet portletCalendar']" />
  <xsl:apply-templates mode="raw" />
</replace>

<!-- make sure it doesn't show up in two places -->
<drop content="//dl[@class='portlet portletCalendar']" />
于 2013-08-09T21:58:32.800 回答