x First time here? Check out the FAQ

How to use it?

    The usage is actually pretty straightforward.

    1. You insert the Item control as you normally do.
    2. You add the xslt attribute, where you specify an XPath expression. This is the same XPath expression you would use in an XSLT value-of element.  The only difference is that you need to add the {0} placeholder for the value of the Item.
    3. The whole value of the Item field is passed into the {0} placeholder. This includes all content like rendered macro's. Basically, it's just the value you see when you omit the xslt attribute.

    Some useful XPath expressions for content pickers:

    Display node name

    umbraco.library:GetXmlNodeById({0})/@nodeName (for content pickers)

    Display node name and author

    concat(umbraco.library:GetXmlNodeById({0})/@nodeName, ' (written by ', umbraco.library:GetXmlNodeById({0})/@writerName, ')')


    Some useful XPath expressions for media items:

    Display node name

    umbraco.library:GetMedia({0}, true())/@nodeName

    Display image

    concat('<img src="', umbraco.library:GetMedia({0}, true())/data[@alias='umbracoFile'], '">')


    Attention with that last expression:
    a) since you're putting this expression in an ASP.Net server tag, you must escape the special XML tokens <, > and "
    b) you don't want the image tag to be displayed as text, but as a tag. So the last one actually becomes:

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

    Note: I have copied the original book from Ruben Verborgh from the books section of umbraco.org