2008-11-12
Tyng-Ruey Chuang
trc@iis.sinica.edu.tw
Institute of Information Science
Academia Sinica, Taipei, Taiwan
We shall study:
We will use these materials in our study:
name
attribute.value
attribute.
The control's "current value" is first set to the
initial value. Thereafter, the control's current value may be modified through
user interaction and scripts.Here are some of the control types defined in HTML:
The following HTML markup:
<form action="http://somesite.com/prog/adduser" method="post"> <p> <label for="firstname">First name: </label> <input type="text" id="firstname"/><br/> <label for="lastname">Last name: </label> <input type="text" id="lastname"/><br/> <label for="email">email: </labelL> <input type="text" id="email"/><br/> <input type="radio" name="sex" value="Male"/>Male<br/> <input type="radio" name="sex" value="Female"/>Female<br/> <input type="submit" value="Send" /> <input type="reset" /> </p> </form>
describes the following form:
textarea
ElementThe following HTML markup:
<form action="http://somesite.com/prog/text-read" method="post"> <p> <textarea name="thetext" rows="10" cols="40"> First line of initial text. Second line of initial text. </textarea> <input type="submit" value="Send"/><input type="reset"/> </p> </form>
describes the following form:
The following HTML markup:
<form action="http://pomelo.iis.sinica.edu.tw/~trc/play/xslt/transform.php" method="get"> <p> <label>Fetch RSS feed from </label> <input type="text" name="site" size="60" value="http://rss.slashdot.org/Slashdot/slashdot"/>. <br/> <label>Transform the RSS feed into the </label> <select name="xsl"> <option value="story.xsl" selected="selected" >full story</option> <option value="headline.xsl" >headline</option> </select> form at the <input type="radio" name="method" value="client"/>client side <input type="radio" name="method" value="server" checked ="checked"/>server side.<br/> <label>Color it </label> <select name="color"> <option value="blue" selected="selected" >blue</option> <option value="pink" >pink</option> </select>!<br/><br/> <input type="submit" value="Do It Now"/> </p> </form>
describes the following form:
The following request is sent out by the browser:
http://pomelo.iis.sinica.edu.tw/~trc/play/xslt/transform.php?site=http://rss.slashdot.org/Slashdot/slashdot&xsl=story.xsl&method=server&color=blue
when the following HTML form is submitted with the initial values:
<form action="http://pomelo.iis.sinica.edu.tw/~trc/play/xslt/transform.php" method="get"> <p> <label>Fetch RSS feed from </label> <input type="text" name="site" size="60" value="http://rss.slashdot.org/Slashdot/slashdot"/>. <br/> <label>Transform the RSS feed into the </label> <select name="xsl"> <option value="story.xsl" selected="selected" >full story</option> <option value="headline.xsl" >headline</option> </select> form at the <input type="radio" name="method" value="client"/>client side <input type="radio" name="method" value="server" checked ="checked"/>server side.<br/> <label>Color it </label> <select name="color"> <option value="blue" selected="selected" >blue</option> <option value="pink" >pink</option> </select>!<br/><br/> <input type="submit" value="Do It Now"/> </p> </form>
You can try it out here:
To use the Web as platform to develop application programs, basically you need to know how to do the following:
Why XML document processing is important in Web programming?
When using XSLT to prepare for the output document in a Web application, we have two choices:
Do it at the server side. The XSLT script is invoked
at Web server to transform an XML document into an
(HTML) document for sending to user browser.
Pros: More flexibility at the server side on how the jobs shall be done.
Cons: More server load, especially when repetitive jobs are requested.
Do it at the client side. Although the XSLT script is located
at the Web server, it is sent to the user browser along with the
to-be-transformed XML document. The XSLT script is invoked by
user browser to produce an (HTML) document for rendering.
Pros: Less server load.
Cons: Shift performance loading to the client side.
Not all user browsers support XSLT. Less flexibility at the server side
on how the jobs shall be done.
Let's do it both ways!
The user provides an RSS 1.0 feed address and specifies how news items in the feed shall be prepared and presented.
RSS 1.0 can be thought as RSS 0.93 with namespace support. The following three modules are often used: Dublin Core, Syndication, and Content
The following is a basic RSS 1.0 (0.9-like) document, making use of only the core RSS 1.0 element set.
<?xml version="1.0"?> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://purl.org/rss/1.0/" > <channel rdf:about="http://www.xml.com/xml/news.rss"> <title>XML.com</title> <link>http://xml.com/pub</link> <description> XML.com features a rich mix of information and services for the XML community. </description> <image rdf:resource="http://xml.com/universal/images/xml_tiny.gif" /> <items> <rdf:Seq> <rdf:li resource="http://xml.com/pub/2000/08/09/xslt/xslt.html" /> <rdf:li resource="http://xml.com/pub/2000/08/09/rdfdb/index.html" /> </rdf:Seq> </items> <textinput rdf:resource="http://search.xml.com" /> </channel> <image rdf:about="http://xml.com/universal/images/xml_tiny.gif"> <title>XML.com</title> <link>http://www.xml.com</link> <url>http://xml.com/universal/images/xml_tiny.gif</url> </image> <item rdf:about="http://xml.com/pub/2000/08/09/xslt/xslt.html"> <title>Processing Inclusions with XSLT</title> <link>http://xml.com/pub/2000/08/09/xslt/xslt.html</link> <description> Processing document inclusions with general XML tools can be problematic. This article proposes a way of preserving inclusion information through SAX-based processing. </description> </item> <item rdf:about="http://xml.com/pub/2000/08/09/rdfdb/index.html"> <title>Putting RDF to Work</title> <link>http://xml.com/pub/2000/08/09/rdfdb/index.html</link> <description> Tool and API support for the Resource Description Framework is slowly coming of age. Edd Dumbill takes a look at RDFDB, one of the most exciting new RDF toolkits. </description> </item> <textinput rdf:about="http://search.xml.com"> <title>Search XML.com</title> <description>Search XML.com's XML collection</description> <name>s</name> <link>http://search.xml.com</link> </textinput> </rdf:RDF>
The following is an RSS 1.0 document pulling in elements from various modules (highlighted in different colors). Note: the modules in this example are for illustrative purposes only; refer to RSS 1.0 Modules for consummate module information.
<?xml version="1.0" encoding="utf-8"?> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:co="http://purl.org/rss/1.0/modules/company/" xmlns:ti="http://purl.org/rss/1.0/modules/textinput/" xmlns="http://purl.org/rss/1.0/" > <channel rdf:about="http://meerkat.oreillynet.com/?_fl=rss1.0"> <title>Meerkat</title> <link>http://meerkat.oreillynet.com</link> <description>Meerkat: An Open Wire Service</description> <dc:publisher>The O'Reilly Network</dc:publisher> <dc:creator>Rael Dornfest (mailto:rael@oreilly.com)</dc:creator> <dc:rights>Copyright © 2000 O'Reilly & Associates, Inc.</dc:rights> <dc:date>2000-01-01T12:00+00:00</dc:date> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>2</sy:updateFrequency> <sy:updateBase>2000-01-01T12:00+00:00</sy:updateBase> <image rdf:resource="http://meerkat.oreillynet.com/icons/meerkat-powered.jpg" /> <items> <rdf:Seq> <rdf:li resource="http://c.moreover.com/click/here.pl?r123" /> </rdf:Seq> </items> <textinput rdf:resource="http://meerkat.oreillynet.com" /> </channel> <image rdf:about="http://meerkat.oreillynet.com/icons/meerkat-powered.jpg"> <title>Meerkat Powered!</title> <url>http://meerkat.oreillynet.com/icons/meerkat-powered.jpg</url> <link>http://meerkat.oreillynet.com</link> </image> <item rdf:about="http://c.moreover.com/click/here.pl?r123"> <title>XML: A Disruptive Technology</title> <link>http://c.moreover.com/click/here.pl?r123</link> <dc:description> XML is placing increasingly heavy loads on the existing technical infrastructure of the Internet. </dc:description> <dc:publisher>The O'Reilly Network</dc:publisher> <dc:creator>Simon St.Laurent (mailto:simonstl@simonstl.com)</dc:creator> <dc:rights>Copyright © 2000 O'Reilly & Associates, Inc.</dc:rights> <dc:subject>XML</dc:subject> <co:name>XML.com</co:name> <co:market>NASDAQ</co:market> <co:symbol>XML</co:symbol> </item> <textinput rdf:about="http://meerkat.oreillynet.com"> <title>Search Meerkat</title> <description>Search Meerkat's RSS Database...</description> <name>s</name> <link>http://meerkat.oreillynet.com/</link> <ti:function>search</ti:function> <ti:inputType>regex</ti:inputType> </textinput> </rdf:RDF>