11

Using XSLT

  • What is XSLT?
  • How do you transform cached content?
  • What is XPath all about?
  • How do you work with media items in XSLT?
  • What are some uses of XSLT for Umbraco?

Ask most developers and they will shudder at the thought of having to use XSLT, Extensible Stylesheet Language Transformation, in any environment. But the truth is that it's a very powerful rendering language and is a perfect fit for the Umbraco XML cache. For those of you who are new to this language, “XSLT is a declarative, XML-based language used for the transformation of XML documents into other XML documents.” This is the short version of the definition on Wikipedia. In the case of Umbraco, the “other XML documents” refer in most cases to the output of HTML, and in some cases the output of other tag-based content. Because XSLT is, in essence, a flavor of XML, it requires that all output and logical markup have a matching start and close tag. You will see the practical application of this requirement in the examples throughout of this chapter.

In Umbraco you can leverage XSLT to access the content that is created in the content tree via macros, as discussed in Chapter 5. To access the XSLT repository, navigate to the Developer section, as shown in Figure 11-1. This chapter shows you the flexibility and versatility of using XSLT to generate content for menus, repeatable lists, and much more.

image A lot of the ...

Get Umbraco User's Guide now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.