{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

AjaxAndPhpAppendixC - C Advanced XML XPath and XSLT You've...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
C Advanced XML: XPath and XSLT You've probably already heard about XSL, XSLT, or even XPath. When people talk about XSL they are sometimes confused. These are complicated subjects indeed and it takes time to master them. This appendix provides a very quick introduction to XSLT and XPath, but if you're serious about these technologies, we recommend you buy a separate book or consult additional resources. What is XSL? XSL is an XML-based language that became a W3C recommendation at the end of the last decade. It includes three sub-parts: XSLT: A language for transforming XML documents XPath: A language for accessing and referring any part of an XML document XSL-FO: A vocabulary for formatting semantics W3C defines XSL like this: "Extensible Stylesheet Language (XSL) is a language for expressing stylesheets. It consists of two parts: a language for transforming XML documents, and an XML vocabulary for specifying formatting semantics." Are you surprised that the definition itself relates XSL to CSS? Well, you shouldn't be, because the name XSL includes 'stylesheet'. While the origins of XSL are in CSS, XSL shares the same functionality and is compatible with CSS2; but there are some differences: XSL adds a transforming language called XSLT; while CSS allows you to define font types, backgrounds, and colors to an HTML page. XSLT allows you to transform an XML document into an (X)HTML page, but at the same time, it can also transform an XML document in any other text file format XSL adds advanced styling features, grouped under a set of formatting objects and attributes
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Advanced XML: XPath and XSLT Because we've talked about CSS and XSL, it is normal to have some questions in this direction: "How does XSL differ from CSS?" "Is XSL is for XML like CSS is for HTML?" These two questions come very natural and it's better to have them answered as soon as possible before getting to the implementation part. How does XSL Differ from CSS? This question could have been answered partially in one of the paragraphs above, but we will try to make things even clearer. CSS uses the HTML predefined tags to format the document, while XSL uses XML tags defined in the XML document. Another important aspect is how the stylesheets are applied relative to the source tree. With CSS, when applying formatting properties to the source tree they are propagated in the source tree according to its structure so that the properties reflect almost identically into the result tree. With XSL, things are different. Due to the fact that we have a formatting object tree (the XSL document, which itself is an XML document) we can apply the formatting properties differently and thus we might have a different result. The inheritance is done via the formatting object tree and not via the source tree.
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}