6 Pages

css-xsl

Course: CSC 309, Fall 2009
School: University of Toronto
Rating:
 
 
 
 
 

Word Count: 1104

Document Preview

Web CSC309: Programming Singin' the Tomcat Blues Greg messed up Web Programming: CSS and XSL Had an old version of hsqldb.jar in one of the (many) directories Tomcat reads from So something that didn't work appeared to If you: Greg Wilson gvwilson@cs.utoronto.ca Summer 2005 1 Feel that you lost so much time with hsqldb.jar issues that it affected your grade, and Had enough work checked in before mid-day...

Register Now

Unformatted Document Excerpt

Coursehero >> Canada >> University of Toronto >> CSC 309

Course Hero has millions of student submitted documents similar to the one
below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.

Course Hero has millions of student submitted documents similar to the one below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.
Web CSC309: Programming Singin' the Tomcat Blues Greg messed up Web Programming: CSS and XSL Had an old version of hsqldb.jar in one of the (many) directories Tomcat reads from So something that didn't work appeared to If you: Greg Wilson gvwilson@cs.utoronto.ca Summer 2005 1 Feel that you lost so much time with hsqldb.jar issues that it affected your grade, and Had enough work checked in before mid-day Friday to prove it, then Come and talk to me about your grade 2 Administrivia No lecture next Monday Assignment 4 due on Tuesday Remark requests: Print the form Write a (readable) explanation of why you think your grade was unfair MIA Are you: c2guralo c3foroog c3mashag c5ipstel c5pengqi g3gabbie Essays, please Final exam schedule has been posted August 8 lecture will peer into the future 3 If so, please come and see me about E2 4 Greg Wilson 1 CSC309: Web Programming Presentation Suppose you have 10,000 web pages, and you want them all to look the same Option 1: use default appearance Which looks like it was designed by engineers CSS Basics You can change default appearance of elements by putting style information in the document header <html> <head> <style type="text/css"> h1 { color: blue; } p { font-style: italic; } </style> </head> <body> <h1>This is a title</h1> <p>This is a paragraph.</p> </body> </html> 5 6 Option 2: use tables and font tags to position things, change style, etc. A nightmare to maintain Option 3: use Cascading Style Sheets (CSS) Separate content from presentation External Style Sheets Much better to store style in an external file Which can be shared between many pages <html> <head> <link rel="stylesheet" type="text/css" href="b.css"/> </head> <body> <h1>This is a title</h1> <p>This is a paragraph.</p> </body> </html> h1 { color: blue; } p { font-style: italic; } Customization Any HTML element may have a `class' attribute <h1 class="maintitle">...</h1. Can specify style for elements of that class: h1.maintitle { font-family: courier} Styles stack on top of one another Which is why they're called "cascading" 7 8 Greg Wilson 2 CSC309: Web Programming ...Customization <html> <head> <link rel="stylesheet" type="text/css" href="c.css"/> </head> <body> <h1 class="maintitle">Main title</h1> <h1>Normal title</h1> </body> </html> h1 { color: blue; } h1.maintitle { font-family: courier; } p { font-style: italic; } CSS Zen Garden 9 10 ...CSS Zen Garden Production Suppose you have 10,000 items in stock, and you want to generate a web page for each of them Oh, but wait: this isn't 1995 Suppose you want to generate: English, French, Chinese, and Korean web pages All of the above for cell phone display Something for a fridge-front display panel And audio 11 12 Greg Wilson 3 CSC309: Web Programming XSL The Extensible Stylesheet Language Three parts: XPath: specify locations in XML document XSLT: transform XML into other things XSL-FO: Formatting Objects We'll ignore these Solar System Data <solarsystem> <star name="Sun"/> <body name="Mercury" orbits="Sun"> <period units="days" length="87.97"/> </body> <body name="Venus" orbits="Sun"> <period units="days" length="224.70"/> </body> <body name="Earth" orbits="Sun"> <period units="days" length="365.26"/> </body> <body name="Moon" orbits="Earth"> <period units="days" length="27.32"/> </body> <body name="Mars" orbits="Sun"> <period units="days" length="686.98"/> </body> <body name="Phobos" orbits="Mars"> <period units="days" length="0.32"/> </body> <body name="Deimos" orbits="Mars"> <period units="days" length="1.26"/> </body> </solarsystem> Basic idea: Applications produce XML with semantic content Stylesheet turns that into something viewable (And if it's HTML, then you apply CSS) 13 14 Getting Names $ cat a.xsl <?xml version="1.0" <xsl:stylesheet encoding="ISO-8859-1"?> version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="body"> <xsl:value-of select="@name"/> </xsl:template> </xsl:stylesheet> $ xsltproc a.xsl solar.xml <?xml version="1.0"?> Mercury Venus Earth Moon Mars Phobos Deimos 15 What Just Happened The template matches each `body' element in turn Establishes a content for operations The value-of selects and prints the value of the matched node's `name' attribute Use `@name' to signal that it's an attribute `name' on its own would mean "an immediate child element with the tag `name'" Note: output doesn't have to be legal XML 16 Greg Wilson 4 CSC309: Web Programming So Let's Produce HTML <?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <html> <body> <xsl:apply-templates/> </body> </html> </xsl:template> <xsl:template match="body"> <p><xsl:value-of select="@name"/></p> </xsl:template> </xsl:stylesheet> ...HTML First template matches the root element of the document <html><body> That's what the XPath expression `/' means <p>Mercury</p> <p>Venus</p> <p>Earth</p> <p>Moon</p> <p>Mars</p> <p>Phobos</p> <p>Deimos</p> </body></html> 17 Anything that isn't in the XSL namespace is copied to the output Like the <html>, <body>, and <p> tags And the whitespace <xsl:apply-templates/> means "go and apply other templates to my children" 18 Declarative [sic] Programming XSL is a declarative programming language Order of templates in .xsl file doesn't matter XSL processor decides what to execute when Richer Selections <xsl:template match="/"> <html> <body> <table> <xsl:apply-templates/> </table> </body> </html> </xsl:template> <xsl:template match="body"> <tr> <td class="text"><xsl:value-of select="@name"/></td> <td class="number"><xsl:value-of select="period/@length"/></td> <td class="text"><xsl:value-of select="period/@units"/></td> </tr> </xsl:template> 19 20 In practice, it's like Make You have to have a mental model of execution order in order to debug <xsl:message>...</xsl:message> is your friend But note: there are several XSL-oriented IDEs on the market Greg Wilson 5 CSC309: Web Programming Richer Control <xsl:template match="body"> <xsl:if test="period/@units='days'"> <xsl:if test="period/@length &lt; 100"> <tr> <td><xsl:value-of select="@name"/></td> <td><xsl:value-of select="period/@length"/></td> </tr> </xsl:if> </xsl:if> </xsl:template> Capturing Attributes <xsl:template match="star"> <p id="{@name}">star</p> </xsl:template> <xsl:template match="body"> <p id="{@name}">body</p> </xsl:template> <html><body><table> <p id="Sun">star</p> <p id="Mercury">body</p> <p id="Venus">body</p> <p id="Earth">body</p> <p id="Moon">body</p> <p id="Mars">body</p> <p id="Phobos">body</p> <p id="Deimos">body</p> </table></body></html> 22 21 Functions Lots of functions available But no way to define your own... Evaluation A simple way to do simple things But hard things are surprisingly hard Because we're not used to thinking this way? Because we shouldn't have to? Because XSL is lame? abs(), ceiling(), floor(), ... concat(), substring(), upper-case(), ... not() index-of(), remove(), one-or-more(), ... count(), avg(), min(), max(), ... position() A lot of sites: Build XML using a `real' programming language Then apply transforms (often designed by nonprogrammers) 23 24 Greg Wilson 6
Find millions of documents on Course Hero - Study Guides, Lecture Notes, Reference Materials, Practice Exams and more. Course Hero has millions of course specific materials providing students with the best way to expand their education.

Below is a small sample set of documents:

Duquesne - LEGISLATIV - 1968
Duquesne - LEGISLATIV - 1968
Duquesne - LEGISLATIV - 1968
Duquesne - A - 1968
PRIOR PASSAGE - NONE PRINTER'S NO.291THE GENERAL ASSEMBLY OF PENNSYLVANIASENATE BILL No. 284REFERRED TO FINANCE, JANUARY 24, 1995Session of 1995INTRODUCED BY JUBELIRER, HART, DAWIDA, GERLACH, BRIGHTBILL, SHAFFER, SALVATORE, LEMMOND, PETERSON, PUNT,
Duquesne - A - 1968
PRIOR PASSAGE - J.R. 1998-3 PRIOR PRINTER'S NO. 241 PRINTER'S NO.2191THE GENERAL ASSEMBLY OF PENNSYLVANIASENATE BILL No. 231Session of 1999INTRODUCED BY CONTI, TOMLINSON, EARLL, BELL, MELLOW, LEMMOND, WAUGH, THOMPSON, WHITE, WOZNIAK, CORMAN AND BRIGH
Duquesne - A - 1968
PRINTER'S NO.1015THE GENERAL ASSEMBLY OF PENNSYLVANIASENATE BILL No. 888Session of 1979INTRODUCED BY HESS, LINCOLN, PECORA, PRICE, JUBELIRER, ZEMPRELLI AND MURRAY, JULY 4, 1979 REFERRED TO CONSTITUTIONAL CHANGES AND FEDERAL RELATIONS, JULY 4, 1979A
Duquesne - A - 1975
PRINTER'S NO.22THE GENERAL ASSEMBLY OF PENNSYLVANIASENATE BILL No. 22Session of 1975INTRODUCED BY KURY, NOLAN, FRAME, MESSINGER, FLEMING, AMMERMAN, MURRAY, EWING, WOOD, HOWARD, MYERS, STAPLETON, JUBELIRER, BELL AND DOUGHERTY, JANUARY 20, 1975 REFERRE
Duquesne - A - 1975
HOUSE AMENDED PRIOR PRINTER'S NOS. 1742, 2009, 2060, 2170PRINTER'S NO.2388THE GENERAL ASSEMBLY OF PENNSYLVANIASENATE BILL No. 1409Session of 1974INTRODUCED BY KURY, MESSINGER, AMMERMAN, ORLANDO, McCREESH, LAMB AND MURRAY, JANUARY 21, 1974 AS AMENDED
InterAmerican Aguadilla - COMP - 2555
PARTIdatabase conceptsDatabase Systems1Data Models2Copyright 2005 by Thomson Course Technology. All rights reserved. This publication is protected by federal copyright law. No part of this publication may be reproduced without prior permission in w
InterAmerican Aguadilla - COMP - 2555
35547_02 7/15/2005 11:56:4 Page 282 T W OData ModelsIn this chapter, you will learn: Why data models are important About the basic data-modeling building blocks What business rules are and how they influence database design How the major data models e
Duquesne - A - 1968
SESSION OF 1996JR. 1996-31547~Thisoint Resolution No. 3 was passed for the first time at the Legislative Session of 1996.) J No. 1996-3 A JOINT RESOLUTION SB 284 Pmposing an amendment to the Constitution of the Commonwealth of Pennsylvania, authorizing
Duquesne - A - 1968
PRIOR PASSAGE - NONE PRIOR PRINTER'S NO. 291PRINTER'S NO.1450THE GENERAL ASSEMBLY OF PENNSYLVANIASENATE BILL No. 284SENATOR HART, FINANCE, AS AMENDED, OCTOBER 3, 1995Session of 1995INTRODUCED BY JUBELIRER, HART, DAWIDA, GERLACH, BRIGHTBILL, SHAFFER
Duquesne - A - 1968
SESSION OF 1997J.R. 1997-1633(This Joint Resolution No. 1 was passed for the first time at the Legislative Session of 1996 as Joint Resolution No.3 and for the second time at the LegislativeSessian of 197 and was approved by the electorate on November
Duquesne - A - 1968
HOUSE AMENDED PRIOR PASSAGE - NONE PRIOR PRINTER'S NOS. 4, 68PRINTER'S NO.112THE GENERAL ASSEMBLY OF PENNSYLVANIASENATE BILL No. 4Special Session No. 1 of 1995INTRODUCED BY FISHER, GREENLEAF, SHAFFER, BRIGHTBILL, MELLOW, ANDREZESKI, WAGNER, WENGER,
Duquesne - A - 1968
SENATE AMENDED PRIOR PASSAGE - J.R. 1995-3(SS1) PRIOR PRINTER'S NO. 1842 PRINTER'S NO.3470THE GENERAL ASSEMBLY OF PENNSYLVANIAHOUSE BILL No. 1520Session of 1997INTRODUCED BY GANNON, DALEY, COY, RUBLEY, BOSCOLA, FARGO, LEDERER, EGOLF, BENNINGHOFF, WOG
Duquesne - A - 1968
SESSION OF 1998J.R.1998-11327(This Joint Resolution No. 1 was passed for the first time at the First Special Legislative Session of 1995-96 as Joint Resolution No. 3 and for the second time at the Legislative Session of 1998 and was approved by the ele
Duquesne - A - 1968
PRINTER'S NO.32THE GENERAL ASSEMBLY OF PENNSYLVANIAHOUSE BILL No. 31Session of 1971INTRODUCED BY MESSRS. KURY, LAUDADIO, BENNETT, RENWICK, FINEMAN, IRVIS, ENGLEHART, WISE, SHELHAMER, FEE, W. W. WILT, STEELE, HETRICK, SCHMITT, SELTZER, BEREN, MALADY,
Duquesne - A - 1968
FIRST SPECIAL SESSION OF 1995-96J.R. 1995-3 (SS1)1153(ThisJoint Resolution No. 3 was passed for the first time at the First Special Legislative Session of 1995-96.)No. 1995-3 A JOINT RESOLUTION SB 12 Proposing an amendment to the Constitution of the C
Duquesne - A - 1968
PRIOR PRINTER'S NO. 1661PRINTER'S NO.2409THE GENERAL ASSEMBLY OF PENNSYLVANIAHOUSE BILL No. 1395Session of 1977INTRODUCED BY MESSRS. IRVIS, MANDERINO, BERSON, SCIRICA, YOHN AND ENGLEHART, JUNE 23, 1977 AS REPORTED FROM COMMITTEE ON JUDICIARY, AS AME
Duquesne - A - 1968
PRINTER'S NO.282THE GENERAL ASSEMBLY OF PENNSYLVANIASENATE BILL No. 280Session of 1977INTRODUCED BY DWYER, LEWIS, ZEMPRELLI, HOWARD, FRAME, HESS, HILL AND HOPPER, FEBRUARY 8, 1977 REFERRED TO CONSTITUTIONAL CHANGES AND FEDERAL RELATIONS, FEBRUARY 8,
Duquesne - A - 1968
PRINTER'S NO.999THE GENERAL ASSEMBLY OF PENNSYLVANIASENATE BILL No. 898REFERRED TO JUDICIARY, JUNE 30, 1975Session of 1975INTRODUCED BY DWYER, FRAME, HESS, ZEMPRELLI, HOWARD, HILL AND LEWIS, JUNE 30, 1975A JOINT RESOLUTION 1 2 3 4 5 6 7 8 9 10 11 1
Duquesne - LEGISLATIV - 1968
SESSION OF 1994 J.R. 1994-1 1461 (This Joint Resolution No. 1 was passed for the first time at the Legislative Session of 1994.) No. 1994-1 A JOINT RESOLUTION SB 218 Proposing an amendment to the Constitution of the Commonwealth of Pennsylvania, further p
Duquesne - LEGISLATIV - 1968
Duquesne - LEGISLATIV - 1968
Duquesne - LEGISLATIV - 1968
Duquesne - LEGISLATIV - 1968
Duquesne - LEGISLATIV - 1968
Duquesne - LEGISLATIV - 1968
Duquesne - LEGISLATIV - 1968
Duquesne - LEGISLATIV - 1968
Duquesne - LEGISLATIV - 1968
Duquesne - LEGISLATIV - 1968
Duquesne - LEGISLATIV - 1968
Duquesne - LEGISLATIV - 1968
Duquesne - LEGISLATIV - 1968
Duquesne - LEGISLATIV - 1968
J.R. 1995-1 (SS1) 1151 FIRST SPECIAL SESSION OF 1995-96 (This Joint Resolution No. I was passed for the first time at the Legislative Session of 1994 as JointResolution No. I and for the second time at the First Special Legislative Session of 1995-96.) N
Iowa State - EE - 230
EE 230 Homework Fall 2006Problem 1 The circuit shown is a comparator with hysteresis. In this circuit, assume R2=10K and R1=100 a) Determine the width of the hysteresis region b) Plot the transfer characteristics. Assume the Op Amp is biased with 15V pow
Duquesne - A - 1968
IN THE NAME AND BY AUTHORITY OF THE~tatth Of~Obetnor~ ffice~AR PUS BUPGPROCLAMATION CONSTITUTIONAL AMENDMENTARTICLE I WHEREAS, Joint Resolution No. 1 of the 1971 Session of the General Assembly of Pennsylvania proposed to amend Article I of the Consti
Lake County - CS - 554
CSE 512/CS 554 Homework Assignment 2 Solutions 1. Construction of the Empire State Building required about two person-millennia of eort, yet the project was completed in only about one year. How was this possible? What must the average workforce have been
Haverford - MATH - 601
GEOMETRY HW 4CLAY SHONKWILER1 Show that a connected Lie group acting on a topological space X induces trivial maps in homology. Is this also true if G is a finite group?2 Let G be a connected, simply connected Lie group and a discrete subgroup of the c
Haverford - MATH - 600
GEOMETRY HW 7CLAY SHONKWILER1 Let K be the Klein bottle dened as the quotient of R2 by (x, y) (x, y + 1) and (x, y) (x + 1, y). Show that the span of x and the span of y dene two smooth 1-dimensional distributions on K. Find their maximal integral manif
Haverford - MATH - 660
DIFFERENTIAL GEOMETRY HW 3CLAY SHONKWILER3. Let S be the &quot;saddle surface&quot; z = y 2 - x2 , officially known as a hyperbolic paraboloid. Parametrize S by the map X : R2 S R3 , X(u, v) = (u, v, v 2 - u2 ), which is the usual way to parametrize the graph of
Haverford - MATH - 661
Stratication of 3 3 MatricesMeesue Yoo &amp; Clay Shonkwiler March 2, 20061Warmup with 2 2 Matrices cfw_ Best matrices of rank 2 = O(2) S 3 ( 2) cfw_ Best matrices of rank 1 S 3 (1)1.1 Viewing O(2) S 3 ( 2)O(2) = cos sin sin cos cos sin sin cos Both
Haverford - MATH - 502
ALGEBRA HW 5CLAY SHONKWILER4.2.11 Let G be a nite group and let : G SG be the left regular representation. Prove that if x is an element of G of order n and |G| = mn, then (x) is a product of m n-cycles. Deduce that (x) is an odd permutation if and only
Haverford - MATH - 502
ALGEBRA HW 2CLAY SHONKWILER1.7.22 Show that the group of rigid motions of an octahedron is isomorphic to a subgroup of S4 . Deduce that the groups of rigid motions of a cube and an octahedron are isomorphic. Proof. Label each face of the octahedron lyin
Haverford - MATH - 660
DIFFERENTIAL GEOMETRY HW 12CLAY SHONKWILER3 Find the Lie algebra so(n) of the special orthogonal group SO(n), and the explicit formula for the Lie bracket there. Proof. Since SO(n) is a subgroup of GL(n), we know that so(n) gl(n) M (n), the n n matrices
Haverford - MATH - 661
DIFFERENTIAL GEOMETRY HW 9CLAY SHONKWILER2. Prove the following inequality on real functions (Wirtingers inequality). Let f : [0, ] R be a real function of class C 2 such that f (0) = f () = 0. Then f 2 dt 0 0(f )2 dt,and equality occurs if and onl
Rocky Mountain College of Art and Design - EE - 579
Weaknesses in the Key Scheduling Algorithm of RC4Scott Fluhrer1 , Itsik Mantin2 , and Adi Shamir21 Cisco Systems, Inc., 170 West Tasman Drive, San Jose, CA 95134 2 Computer Science department, The Weizmann Institute, Rehovot 76100, Israel.sfluhrer@cisc
Berkeley - MCB - 136
13609 EXAM 2 TOPICS Reading: Chs 12, 14, 15, 17, 18 MUSCLE Distinguish anatomical and molecular structures of skeletal, cardiac and smooth muscles: neuromuscular junction of somatic motor nerves for skeletal muscle vs. varicosities of autonomic nerves for
Allan Hancock College - ELEC - 5101
ELEC 5101 Antennas and Propagation Quarter wave Monopole ExperimentsEquipment HP 85046A Network analyzer HP 141 Spectrum analyzer Slotted Line RF Signal Generator Various ReflectorsIntroductionBy definition, all of today's wireless communication system
University of Toronto - CSC - 2431
SpecializedHardware forReadMappingTimSmith(tsmith@cs) 2008/02/27ClawHMMERisbasedoffof HMMer(Eddyetal.)HMMerusesHMMstodetermine theprobabilityofaproteinsequence belongingtoaproteinfamilyStep1:BuildaProfileHMMfromamultiple alignmentofproteinsequencesNo
University of Toronto - CSC - 2431
Genome-Wide Mapping of in Vivo Protein-DNA InteractionsJohnson et al (Science 2007) Presented by Leo J. LeeMar. 19, 2008 CSC 2417 1Outline Background on ChIP based methods to study protein-DNA interactions Salient features of ChIPSeq Overview of the e
University of Toronto - CSC - 2431
Paul Medvedevs brain= Brainchild!+Michael Brudnos brainAb Initio Whole Genome Shotgun Assembly With Mated Short ReadsPresented by Lucas Lochovsky1Outline 2Whole Genome Assembly Review of Related Work The Medvedev-Brudno Method Methods: Bidirecte
University of Toronto - CSC - 2431
Paper Presentation: Justin Ho (jho@dgp) Paper Authors: Korbel, et al.http:/www.pnas.org/cgi/content/full/104/24/101102/12/20081Copy-number variants are form of genetic variation in population Genotype-phenotype studies want to know about CNVs We only
Purdue - MA - 162
MATH 162 Exam 3 Answers1. A 2. D 3. B 4. E 5. E 6. E 7. C 8. D 9. B 10. C 11. D 12. B
Cornell - ECON - 301
Econ 301 F07 Answers to PROBLEM SET 4 - due in class on Thursday Oct 25 Wissink 1. Derive/recall the demand functions for x &amp; y for the utility function u(x, y) = xy. Calculate the ownprice elasticity of demand for x using the demand function for x you de
Wisconsin - NS - 332
The Food Price Crisis of 2007 to ?Is the Malthusian prophecy coming true?Kenneth Shapiro April 24, 2009Thomas Malthus, An Essay on the Principle of Population, 1798, as cited in LF, p.130 &quot;Population, when unchecked, increases in a geometrical ratio. S
Kentucky - ECO - 471
Chapter 8The Instruments of Trade PolicySlides prepared by Thomas BishopPreview Partial equilibrium analysis of tariffs: supply, demand and trade in a single industry Costs and benefits of tariffs Export subsidies Import quotas Voluntary export restra
Wellesley - LATIN - 310
Livy and Cicero on the Death of Romulus: VocabularyWith thanks to the Digital Latin LexiconLivy 1.15.6-1.16ferme - (1) &lt;almost, nearly&gt;; with negatives, &lt;hardly, scarcely&gt;. (2) &lt;usually&gt;. absonus -a -um - &lt;inharmonious, discordant, disagreeing&gt;. origo
Purdue - CE - 697
A graduate class at Purdue University is undertaking a survey in an attempt to gain a better understanding of public opinions on a wide variety of subjects. We appreciate your time in completing this survey - your responses will be strictly confidential.
Lake County - IB - 150
The plan for the last three lectures of the semester:- Monday Dec. 5 - The Red Queen Hypothesis: Microevolution in Pathogenic Microorganisms Wednesday Dec. 7 - Dr. Berlocher's research (Apples, Pests, and Evolution) Friday Dec. 9 - Careers in Integrative