70 likes | 165 Views
XSL. COSC643 Internet Supply Chain Management Sungchul Hong. XSL. Extensible Stylesheet Language XSL XSLT (Transformation) XSLFO (Formatting Objects) Similar to CSS. <?xml version= "1.0" ?> <?xml-stylesheet type="text/xsl" href="test.xsl"?> <document> <message> It worked!
E N D
XSL COSC643 Internet Supply Chain Management Sungchul Hong
XSL • Extensible Stylesheet Language • XSL • XSLT (Transformation) • XSLFO (Formatting Objects) • Similar to CSS
<?xml version= "1.0" ?> <?xml-stylesheet type="text/xsl" href="test.xsl"?> <document> <message> It worked! </message> <message> second line </message> </document>
<?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version= "1.0" > <xsl:template match= "/" > <html> <body> <h1><xsl:value-of select= "document/message" /></h1> </body> </html> </xsl:template> </xsl:stylesheet>
Templates • Templates are used to decide what element should be output, and how. <xsl:template match=“/”> <xsl:value-of select=“.”/> </xsl:tempalte>
xsl:value-of • Select a specific node: “node name” • Select all the nodes: “.” <xsl:template match=“/”> <xsl:value-of select=“.”/> </xsl:tempalte>
xsl:apply-templates/ • Telling the processor that after it’s finished applying this template, it should go on and see whether there are any other templates that apply.