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 discussion in this chapter has to do with XPath and XSLT. If you'd like more information or instruction on these languages, check out Beginning XSLT and XPath: Transforming XML Documents and Data by Ian Williams (Wiley, 2009).

FIGURE 11-1

image

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset