Understanding XSL: The Power of Extensible Stylesheets
120 likes | 214 Views
Learn how XSL transforms XML data into styled outputs, rearranges elements, and more. Discover the differences between XSL and CSS, and see examples of XSLT in action.
Understanding XSL: The Power of Extensible Stylesheets
E N D
Presentation Transcript
Technology Reviews:XSL 20031042 Park, Ho-gun
What is XSL • Extensible Style sheet Language • An XML-based language used to create to style sheets
What it does • Define layout of the output document • Define font and alignment of text • Define where to get the data from within the input document • Rearrange elements • Source tree( input document ) • Result tree( output document )
Composition of XSL • A transformation language • which is named XSLT • switch a tag to another tag • EX. XSL -> HTML, XML -> HTML + CSS • Rearrange element and add contents • A language used to describe XML document for display • XSL Formatting Objects • More powerful display
CSS and XSL • Impose a standard style on a whole document • but, there are several differences.
CSS Only define property XSL change order of elements for display iterative and selective process to elements add contents Differences:CSS and XSL
CSS Selector and Properties selector { properties } XSL Pattern and Formatting object <xsl:template pattern="pattern"> <formatting objects/></xsl:template> Differences:CSS and XSL • example • quote { display: block; font-size: 90%; margin-left: 0.5in; margin-left: 0.5in } • example • <xsl:template pattern="quote"> <fo:block font-size="90%" indent-start="0.5in" indent-end="0.5in"> <xsl:process-children/> </fo:block></xsl:template>
How do XSLT style sheets works? • XSLT style sheets are built on structures called templates • A template specifies what to look for in the source tree, and what to put into the result tree. • XSLT is written in XML • There are special XSLT elements and attributes
namespace Printing form • <?xml version="1.0" encoding="euc-kr" ?> • <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> • <xsl:output method="html" version="4.0" encoding="euc-kr" /> • <xsl:decimal-format NaN=“none" /> • <xsl:template match="/"> • <html> • <head> • <title><xsl:text>Book list</xsl:text></title> • <link rel="stylesheet" type="text/css" href="books.css" /> • </head> • <h1><xsl:text>Book table</xsl:text></h1> • <table border="1"> • <tr> • <th>No.</th> • <th>ISBN code</th> • <th>Name</th> • <th>Company</th> • <th>Price</th> • <th>date</th> • </tr> • <xsl:apply-templates select="books" /> • </table> • </html> • </xsl:template> css Call <xsl:template match=“books”>~</xsl:templete>