Tham khảo tài liệu 'xml by example- p5', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | XSLFO 185 Figure XMetaL a WYSIWYG editor XSLFO CSS is a simple and efficient styling mechanism. However it is limited to styling a document it cannot reorganize or otherwise process them. CSS cannot build a table of contents or extract an index as XSLT. XSLT and CSS I EXAMPLE Nothing prevents you from combining XSLT with CSS. Listing shows how an XSLT style sheet can attach a CSS style sheet to a document and create a table of contents in XML. Figure shows the result in a browser. Listing XSLT Style Sheet xml version encoding ISO-8859-1 xsl stylesheet xmlns xsl http 1999 XSL Transform xsl template match xsl processing-instruction name xml-stylesheet href type text css xsl processing-instruction xsl apply-templates xsl template continues 186 Chapter 6 XSL Formatting Objects and Cascading Style Sheet Listing continued xsl template match keywords keywords xsl apply-templates keywords section title Table of Contents title xsl for-each select article section title p xsl value-of select . p xsl for-each section xsl template xsl template match xsl copy xsl apply-templates x xsl copy xsl template xsl stylesheet OUTPUT Figure The result in a browser Figure shows how it works. First you apply an XSLT style sheet to the document. XSLFO 187 Refer to Chapter 5 XSL Transformation for instructions on how to apply XSLT style sheets with LotusXSL. This XSLT style sheet creates an XML document not an HTML document. It reorganizes the document by creating a table of contents. The XSLT style sheet also inserts a processing instruction that links the XML document to a CSS style sheet. The browser loads the XML document and the CSS style sheet to format it. The major advantage of this solution when compared to using XSLT to create an HTML document is that the final document is in XML. Therefore the final document still contains structure-rich markup. Figure Combining XSLT and CSS XSLFO O i vg EXAMPLE If using CSS in .