= XSLT - Making XSLT Your Friend = == What and Why == XSLT enables you to convert XML into other forms. For example, XML markup can be converted to HTML markup for display on the web. Or, XML markup can be converted to a simple text-only Read Me file. Yet another example would be the conversion of XML into FO (Formatting Objects) for PDF production or into help systems such as !JavaHelp, Eclipse Help, Microsoft HTML Help 1.x, or !WebWorks Help. == 10,000ft View == XSLT gives you two basic building blocks: * Templates * Matching system === Templates === Templates enable you to emit markup. {{{ }}} For example, given this input: {{{ Power Hour }}} XSLT enables you to output a simple HTML document using this XML source: {{{ Power Hour

Power Hour

}}} === Matching system === XSLT's matching system enables you to say when/where a template should be used. {{{ }}} Using the XML example above: For example, given this input: {{{ Power Hour }}} XSLT allows us to perform different actions in different situations: {{{ Power Hour

Power Hour

}}} Result: {{{ Power Hour

Power Hour

}}} == XSLT Transform Playground == You can experiment with XSLT in your browser with !WebWorks' "XSLT Transforms" toy. Access it from: http://toys.webworks.com/ Clicking on the link for "XSLT Transforms" creates a new session for you: http://toys.webworks.com/xslt-transforms/ You can create a bookmark to return to this session at any time in the future. The XSLT toy will automatically save and apply changes you make to your XML input and XSLT stylesheet as you type. == Power Hour XML + XSLT == During the Power Hour session, we created a simple XML input document and XSLT transform to display the XML as HTML. We used the following XML input and XSLT stylesheet: * {{attachment:XML Input.xml}} * {{attachment:XSLT Stylesheet.xml}} You can experiment with this example by creating a new "XSLT Transforms" toy and cut/pasting contents into the appropriate input area. == Terminology == Stylesheet:: XSLT source file which contains your Templates. Templates:: Markup to emit when a particular element/node is matched. XPath Expression:: Way to express how content should be matched. Enables you to treat an XML document like a database and perform queries against it.