XSL tranformations uses declarations and XPath to locate specific structures and do something with the content or the with the content and structure.
From an editing standpoint, XSLs are edited on the staging server and do not need to be published. Changes are immediate and the change in the transformation of the content can be seen by re-previewing a page or otherwise refreshing the mode that is being used.
The process of creating XSL stylesheets and XML content can seem daunting at first, but done properly the results can be quite powerful and rewarding. To begin the process, start with a simple XML document that requires styling. This XML file should contain all of the content that the final page will display and have a file extension of PCF (which will classify it as a Publish Control File). If working within a currently live implmentation or workshop, an entire directory can be copied or a single page file can be copied and used to test with so that erronous changes will not effect a live page. Also, commit a version of the XSL, before performing extensive editing, as it may be necessary to revert to a previous version. Once such a document is in place, the content portion of the XML/XSLT combination is complete. The look and feel of the content will be supplied by an XSL stylesheet. Much like an HTML document references a CSS file to provide formatting, an XML document references an XSL stylesheet to provide the structure for the content and the processing of the formatting that visitors will see.
The pcf-stylesheet is used to call an XSL stylesheet from the PCF:
<?pcf-stylesheet path="/faculty-stylesheet.xsl" extension="html"?>
Download the PCF example, open it in a text editor, and notice the prologue at the top of the file.
For more information about the attributes and usage of this processing instruction, please visit the PCF (Publish Control File) Overview page.
Once the PCF file references an XSL, the next step is to start structuring how the XML content should be displayed and formatted. This is accomplished that through the use of the XSL statements and some XPath values similar to the following:
<xsl:value-of select="document/title" />
<xsl:copy-of select="document/content/node()" />
For a complete reference of the available XSL elements, visit the XSL Reference page.
The next step is to publish the page. Unless specifically coded otherwise, the preview of a page will also render a transformation.
The Advanced XSL section includes a topic with more advanced information about XSL.