.. ================================================== .. FOR YOUR INFORMATION .. -------------------------------------------------- .. -*- coding: utf-8 -*- with BOM. .. include:: ../../Includes.txt A basic transformation ^^^^^^^^^^^^^^^^^^^^^^ Let's explain some of the basic features of the XSLT content object like loading the XML and XSL data and starting a transformation. We have the following XML in a file in our fileadmin folder: .. code-block:: xml Fight for your mind Ben Harper 1995 Electric Ladyland Jimi Hendrix 1997 During page generation, we want to load the XML and transform it to the following HTML: .. code-block:: html

CD Collection

Hey! Welcome to our sweet CD collection!

Fight for your mind
by Ben Harper - 1995
Electric Ladyland
by Jimi Hendrix - 1997
Using the XSLT content object, this is pretty straightfoward. First we configure the source: :: page.10 = XSLT page.10 { source = fileadmin/collection.xml } Next, we need to load the XSL styles that will perform the transformation. The XSLT object gives you the possibility to define a transformation 'pipeline', each with it's own configuration and stylesheet through which the XML data gets send. Transformations are configured below the **transformation.** property. We proceed: :: page.10 = XSLT page.10 { source = fileadmin/collection.xml transformations { 1 { stylesheet = fileadmin/collection.xsl } } stdWrap.wrap =
|
} The stylesheet subproperty fetches the XSL styles from the specified file. If everything is ok, the XSLT processor is started and runs through all configured transformation steps. The final result is passed to stdWrap, like you can see above. Here's the XSL stylesheet: .. code-block:: xml

Hey! Welcome to our sweet CD collection!

by -
And here is the output: .. figure:: ../../Images/manual_html_670467ff.png Nice. But wait... what's that “default” thing doing in the

? When we check the stylesheet, we see that the plan seems to have been to set the content of the

dynamically using a . We will fill in the title of the current TYPO3 page. For this, we simply register the defined param in our TypoScript and process it's value with stdWrap: :: page.10 = XSLT page.10 { source = fileadmin/collection.xml transformations { 1 { stylesheet = fileadmin/collection.xsl setParameters { pagetitle.value.data = page : title } } } stdWrap.wrap =
|
} Output: .. figure:: ../../Images/manual_html_105e423b.png Ah, that's better ;)