1 / 9

INFO 440: Information System Design Fall 2003 * Bob Boiko * MSIM Associate Chair

INFO 440: Information System Design Fall 2003 * Bob Boiko * MSIM Associate Chair. XML Transforms. Templates as Programs. Templates have processor programs that read them and form an output page. Templates as Programs.

ayla
Download Presentation

INFO 440: Information System Design Fall 2003 * Bob Boiko * MSIM Associate Chair

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. INFO 440: Information System Design Fall 2003 * Bob Boiko * MSIM Associate Chair XML Transforms

  2. Templates as Programs Templates have processor programs that read them and form an output page. INFO 440: Information System Design * Fall 2004 * Bob Boiko * MSIM Associate Chair

  3. Templates as Programs <HTML>   <HEAD>[Insert Title]</HEAD>   <BODY>[Insert Body]</BODY></HTML> <xsl:template match="/">   <HTML>      <xsl:apply-templates />   </HTML></xsl:template><xsl:template match="Title">   <TITLE>      <xsl:value-of select="."/>   </TITLE></xsl:template><xsl:template match="Body">   <BODY>      <xsl:value-of select="."/>   </BODY></xsl:template> <HTML>   <HEAD>@@(Title)@@</HEAD>   <BODY>      <!– TemplateBeginEditable name=“head” -->      <!– TemplateEndEditable -->   </BODY></HTML> <HTML>   <HEAD>      <CMSCommand>         <INSERT COMPONENT="ID" ELEMENT="Body">            <CUSTOMCOMMAND NAME="SectName" File="Myfunct.dll"/>         </INSERT>      </CMSCommand>   </HEAD>   <BODY>      <INSERT COMPONENT="ID" ELEMENT="Body"/>   </BODY></HTML> Function BuildPage(ID)   Set Component = LoadComponent(ID)   Title = Component.GetElement("title")   Body = Component.GetElement("body")   Output ("<HTML><HEAD>“)   Output (Title)   Output ("</HEAD><BODY>”)   Output (Body)   Output ("</Body></HTML>”)End Function <HTML>   <HEAD><%=sTitle%></HEAD>   <BODY><%=sTitle%>  </BODY></HTML> INFO 440: Information System Design * Fall 2004 * Bob Boiko * MSIM Associate Chair

  4. What is XSLT? • A way to transform XML • To HTML • To text • Not too good at other formats ( • A way to add formatting • A programming language • Not for end users • Not too hard for easy things • Will need to use “real” programming where it fails INFO 440: Information System Design * Fall 2004 * Bob Boiko * MSIM Associate Chair

  5. Why use It? • Standardizes your publications • Reuse • Create one transform (i.e., XSL file) many pages • One content chunk many presentations • Assures well formed output • Separates processing code from presentation code (sort of) INFO 440: Information System Design * Fall 2004 * Bob Boiko * MSIM Associate Chair

  6. Major Player XML • XSL is XML! • All the same rules apply <xsl:stylesheet> <xsl:templatematch="/">      <h1>           <xsl:value-ofselect="//title"/>      </h1>      <h2>           <xsl:value-ofselect="//author"/>      </h2> </xsl:template></xsl:stylesheet> INFO 440: Information System Design * Fall 2004 * Bob Boiko * MSIM Associate Chair

  7. Major Player Templates & XPath • The whole file is a stylesheet • Stylesheets have templates • Templates have selectors • Selectors use XPath • Templates contain value-of’s • Value-of’s contain selectors INFO 440: Information System Design * Fall 2004 * Bob Boiko * MSIM Associate Chair

  8. Template Example Taken from http://www.zvon.org/xxl/XSLTutorial/Output/example1_ch1.html INFO 440: Information System Design * Fall 2004 * Bob Boiko * MSIM Associate Chair

  9. The Spy debug environment INFO 440: Information System Design * Fall 2004 * Bob Boiko * MSIM Associate Chair

More Related