XSLT

Chrissy Wainwright

What is XSLT?

eXtensible Stylesheet Language Transformations

How Diazo works behind the scenes.

Why is XSLT needed?

XSLT may not be necessary in your Diazo theme, depending on how complex your selectors need to be.

Example

<replace css:theme-children=".mainNav">
    <xsl:for-each css:select="#portal-globalnav > li">
        <li class="divider"></li>
        <xsl:apply-templates css:select="li.plain, li.selected"/>
    </xsl:for-each>
    <li class="divider"></li>
</replace>

This grabs each <li> from Plone, and inserts an <li> as a divider between each one.

Note that the css: prefix can also be added to the XSL in Diazo.

Another Example

<xsl:for-each css:select="#portal-personaltools a">
    <li>
        <xsl:copy-of select="current()"/>
    </li>
</xsl:for-each>

Grabs all links from user dropdown and puts them into a list.

(instead of a <dl>)

Warnings

Use Diazo rules when possible, XSLT has a steep learning curve.

XSLT errors aren't very helpful.

SpaceForward
Right, Down, Page DownNext slide
Left, Up, Page UpPrevious slide
POpen presenter console
HToggle this help