热搜: 活动 交友 discuz
查看: 3990|回复: 0


发表于 2014-12-21 14:03:22 | 显示全部楼层 |阅读模式
What is XSLT?It stands for 'eXtensible Stylesheet Language Transformations'. It is how Diazo works behind the scenes - all rules you write are actually translated to XSLT.
Why is XSLT needed?It may not be needed at all, depending on how complex the selectors need to be in your Diazo rules. If you need to do anything involving loops or if statements, you'll need some XSLT.
  1. <replace css:theme-children=".mainNav">
  2. <xsl:for-each css:select="#portal-globalnav > li">
  3.    <li class="divider"></li>
  4.    <xsl:apply-templates css:select="li.plain, li.selected"/>
  5. </xsl:for-each>
  6. <li class="divider"></li>
  7. </replace>

This grabs each list item from Plone, and inserts a list item as a divider between each one. Note that the css: prefix can also be added to the XSLT within Diazo rules to use CSS style selectors.
  1. <xsl:for-each css:select="#portal-personaltools a">
  2. <li>
  3.    <xsl:copy-of select="current()"/>
  4. </li>
  5. </xsl:for-each>

This pulls all links from the user dropdown and puts them into a list, instead of having them in a definition list.
  • XSLT has a steep learning curve. Make sure you have plenty of time and patience before tackling XSLT on your own.
  • XSLT errors aren't very helpful. I don't have any good advice to help with this, except to maybe leave any expensive, breakable things out of your reach.
More examples and resourcesI hope this gives you a brief understanding of how to utilize XSLT in your Diazo theme. You can find more examples and resources at:


使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册


QQ|小黑屋|Archiver|手机版|Plone技术资料 ( 湘ICP备14006519号-1 )

GMT+8, 2019-11-18 09:05 , Processed in 1.577300 second(s), 14 queries , Gzip On.

Powered by Plone! X3.4

© 2001-2019

快速回复 返回顶部 返回列表