Written by Ruben Verborgh   
Not Version related

XSLT Example
How to use the handy inline XSLT expressions to customize item output.

Chapters

What is it?

Attention: the features described in this document are only available with the latest source code version of Umbraco 4 beta, which is available on CodePlex.

Everyone knows the umbraco:Item element that is used to display a field on your template.

< umbraco:Item runat="server" field="bodyText" />

Of course, it gets a bit trickier if you want to display a media item from a media picker field, because...

< umbraco:Item runat="server" field="mediaItem" />

...actually just displays the node ID. Which is not what you want probably. I think what you want is...

< umbraco:Item runat="server" field="mediaItem" xslt="umbraco.library:GetMedia({0},'true')/@nodeName" />

... which displays the name of the item. Or if it's an image, you might event want this:

< umbraco:Item runat="server" field="mediaItem"
xslt="concat('&lt;img src=&quot;', umbraco.library:GetMedia({0},'true')/data[@alias='umbracoFile'], '&quot; /&gt;')"
xsltDisableEscaping="true" />

...which displays the image itself.

RSS Feed for Documentation RSS Feed for docs (syndicate)

  • Latest forum posts

Brilliant umbraco hosting provided by FAB-IT