Subject: Re: XML/XSL on the client for dynamic UI From: Tim Taylor <ttaylor@xxxxxxxxxx> Date: Mon, 01 Nov 1999 19:11:57 -0500 |
Mark Hayes wrote: > > > From: Tim Taylor [mailto:ttaylor@xxxxxxxxxx] > > Is every page dynamic with every request? I've found that > > with Cocoon, > > once a page is cached, it frequently finishes processing in > > under 50ms. > > Just curious: By "cached" do you mean that only the stylesheet and source > document are cached with Cocoon, or is the result document cached as well? > I assume the result is not cached, but I just wanted to be sure. 50 ms is a > good number. Actually, I assumed the result was cached. Also, remember that 50ms was the ceiling once cached. Here are some numbers: first request, no cache: 2934 ms reload, cached: 5 ms reload, XML "touched", XSL cached (presumably): 2366 ms reload, cached: 4 ms reload, XML cached (presumably), XSL "touched": 2672 ms reload, cached: 5 ms This is with Cocoon configured to use OpenXML and XSL:P, though, for the simple XML and stylesheet I used there probably wouldn't be much difference with other parsers and processors. Anyhow, the point isn't to be a benchmark (too many variables), but just to point out that caching can give you order of magnitude improvements. Of course, I should also point out that Cocoon is a memory hog...no suprises there :) I've attached my test documents. Please disregard the content, I put it together when I was just learning XML :) FYI, the developers have some pretty agressive goals with respect to non-cached processing times. The project is worth checking out at http://java.apache.org/ Tim > > We have been seeing 130 ms for XT processing with a cached stylesheet and a > medium sized source document, but the source document is reparsed as part of > this operation. (We're still working on a DOM-to-SAX translator so that the > source document can be cached as well. If anyone happens to have this code > and is willing to share it please let me know...!) > -- > thanks, > mark > > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list -- Tim Taylor
<?xml version="1.0"?> <?cocoon:process type="xslt"?> <?xml-stylesheet href="outline.xsl" type="text/xsl"?> <presentation> <title>eXtensible Markup Language (XML) Overview</title> <slideset> <slide> <title>Overview</title> <subtitle>what I'll talk about</subtitle> <ol> <li>Why XML. Why XML was created, what purpose does XML have, why use XML.</li> <li>What XML. What is XML. What does it look like. What does it have in common with HTML.</li> <li>How XML. How to work with XML. How to write software to utilize XML.</li> </ol> </slide> <slide> <title>Why XML?</title> <slideset> <slide> <title>History</title> <dl class="calendar"> <dt>1986</dt> <dd>SGML</dd> <dt>1992</dt> <dd>HTML 1.0, semantic</dd> <dt>1996</dt> <dd>HTML 3.2</dd> <dt>Febuary, 1998</dt> <dd>XML 1.0</dd> <dt>April, 1998</dt> <dd>HTML 4.0</dd> </dl> </slide> <slide> <title>Why was XML created</title> XML was created to restore semantic markup to the Web. Why is this good? <ol> <li>allows more than just graphical browsers to be consumers of info on the Web. <ol> <li>non-graphical browsers (screen readers)</li> <li>search engines</li> <li>computers in business to business (b2b) communication</li> </ol> </li> <li>seperates formatting from content. Focus on content and structure</li> </ol> </slide> <slide> <title>Why use XML?</title> <ol> <li> seperate presentation from content <ol> <li>presentation can change independent of the underlying mechanism for generating, retrieving, syndicating content</li> <li>presentation can change without breaking other consumers of information</li> <li>multiple presentations of same content</li> </ol> </li> <li>validation</li> <li>common set of content manipulation tools v. ad hoc tools <ol> <li>content administration</li> </ol> </li> </ol> </slide> </slideset> </slide> <slide> <title>What XML?</title> <slideset> <slide> <title>What is XML</title> <ul> <li><strong>SGML</strong> is a language <strong>for defining</strong> markup languages</li> <li><strong>HTML</strong> is a language that <strong>is defined</strong> using <strong>SGML</strong></li> <li><strong>XML</strong> is a <strong>refinement</strong> of <strong>SGML</strong></li> <li><strong>XHTML</strong> is a language that <strong>is defined</strong> using <strong>XML</strong></li> </ul> <p>Consequently, XML and HTML are structurally similar, i.e. their markup looks alike in many ways</p> </slide> <slide> <title>Structural Similarities between XML and HTML</title> <code class="html"><![CDATA[<html> <head> <title>sample HTML</title> </head> <body> <h1>sample HTML</h1> <h2>another header</h1> <p>This is a paragraph<br> with some breaking<br> text</p> </body> </html>]]></code> <code class="xml"><![CDATA[<?xml version="1.0"?> <my-document> <title>sample HTML</title> <header>another header</header> <paragraph>This is a paragraph<br/> with some breaking<br/> text</paragraph> </my-document>]]></code> <ol> <li>elements</li> <li>attributes</li> <li>comments</li> </ol> But don't confuse the structural similarity with functional similarity </slide> <slide> <title>XML is more than HTML</title> XML is structurally different: <ol> <li>stricter requirements. (makes developing tools easier, leaves fewer things to doubt) <ol> <li>must have a single, top-level element. This is called the root element. <span class="comment">[examples here]</span></li> <li>tag attributes must have quotes <span class="comment">[example here]</span></li> <li>all tags must have an end tag, or be an empty tag <span class="comment">[example]</span></li> </ol> </li> <li>processing instructions <span class="comment">[example here, including reserved 'xml']</span></li> <li>CDATA sections <span class="comment">[example, explain why it's usefull]</span></li> </ol> </slide> <slide> <title>What makes a document an XML document</title> <subtitle>when is an XML document not an XML document</subtitle> <ol> <li>Well formed XML document (http://www.xml.com/axml/target.html#sec-well-formed). As an oversimplification, an document is a well formed XML document if: <ol> <li>it contains one or more elements.</li> <li>there is exactly one element, called the root, or document element, that only appears as the first and last tags (open and close tags) in the document</li> <li>the elements, delimited by start- and end-tags, nest properly within each other <span class="comment">[example here]</span></li> </ol> </li> <li>Valid XML document (http://www.xml.com/axml/target.html#dt-valid). A document is a valid XML document if: <ol> <li>it is a well formed XML document</li> <li><p>if it has an associated document type declaration (DTD) and if the document complies with the constraints expressed in the DTD</p> <p>briefly, a DTD defines:</p> <ol> <li>what elements (tags) are allowed in the document</li> <li>how those tags can/must be structured</li> <li>what attributes are allowed in an element</li> <li>which of those attributes are required</li> <li>default values for attributes <span class="comment">[example here]</span></li> </ol> </li> </ol> </li> <li>Otherwise, it's not an XML document, even if it looks like an XML document, or has an .xml extension. This may seem like beating a dead horse, but it is basically a lesson learned from the browser wars <span class="comment">[rephrase/elaborate]</span></li> </ol> </slide> <slide> <title>What XML doesn't do</title> <p>XML doesn't:</p> <ol> <li>say what the tags mean (though you should choose meaningfull tag names)</li> <li>describe how to format the document. Formatting descriptions, when necessary, come from an external source.</li> <li>prescribe one-to-one relationship between "document" and "page". With HTML, if you break a book into chapters, each chapter an HTML document, they're only related because they might have reciprocal links, live in the same directory, or whatever. But they're not technically part of a larger document called "book"</li> </ol> </slide> </slideset> </slide> <slide> <title>How XML?</title> <slideset> <slide> <title>Programming With XML</title> <ol> <li>Document Object Model (DOM) core API</li> <li>Simple API for XML (SAX)</li> <li>custom/proprietary APIs</li> <li>Tranformation (XSL, XSL:T (XTL)</li> </ol> </slide> <slide> <title>How to transition to XML</title> <subtitle>sneaking in XML when your Project Manager isn't looking</subtitle> <ol> <li>write valid HTML, and use validation software</li> <li>use end-tags, even when they're optional. For example: <dl> <dt>paragraphs</dt> <dd><code class="xhtml"><![CDATA[<p>...</p>]]></code></dd> <dt>lists</dt> <dd><code class="xhtml"><![CDATA[<li>list item</li>, <dt>term</dt>, <dd>description</dd>]]></code></dd> <dt>and these</dt> <dd><code class="xhtml"><![CDATA[<html>...</html>, <body>...</body>, <td>...</td>, etc.]]></code></dd> </dl> </li> <li>always quote attributes: <code class="xhtml"><![CDATA[<div class="foo">]]></code></li> <li>write XHTML <ol> <li>valid empty-tags (with a twist): <code class="xhtml"><![CDATA[<br />, <hr />]]></code></li> </ol> </li> </ol> </slide> <slide> <title>XML is for more than the Web</title> <subtitle>Andrew made me say this</subtitle> Similar to Java, which was designed originally for consumer appliances, specifically T.V. set top boxes, XML, which was designed for the Web is applicable in more areas</title> </slide> </slideset> </slide> <slide> <title>Conclusion</title> <subtitle>what I talked about</subtitle> <ol> <li>One purpose of XML is to restore semantic meaning to the Web so that other things besides graphical browsers can be consumers of the information</li> <li>XML is a language definition language, refined from XML. It has structural similarities to HTML, but is functionally different</li> <li>Transition to XML through XHTML. Stable and evolving XML APIs and technologies</li> </ol> </slide> </slideset> </presentation>
<?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/XSL/Transform/1.0" xmlns="http://www.w3.org/TR/REC-html40"> <!-- Root template - start processing here --> <xsl:template match="/"> <html> <head> <title><xsl:value-of select="presentation/title"/></title> <link rel="stylesheet" href="outline.css" type="text/css" /> </head> <body> <h1><xsl:value-of select="presentation/title"/></h1> <xsl:apply-templates select="presentation"/> </body> </html> </xsl:template> <xsl:template match="title"> <!-- supress titles --> </xsl:template> <xsl:template match="slide"> <h2><xsl:value-of select="title"/></h2> <xsl:apply-templates/> </xsl:template> <xsl:template match="slide/subtitle"> <p class="parenthetical">...<xsl:apply-templates/></p> </xsl:template> <xsl:template match="ol"> <ol> <xsl:apply-templates/> </ol> </xsl:template> <xsl:template match="ul"> <dl> <xsl:apply-templates/> </dl> </xsl:template> <xsl:template match="li"> <li><xsl:apply-templates/></li> </xsl:template> <xsl:template match="dl"> <dl> <xsl:apply-templates/> </dl> </xsl:template> <xsl:template match="dd"> <dd><xsl:apply-templates/></dd> </xsl:template> <xsl:template match="dt"> <dt><xsl:apply-templates/></dt> </xsl:template> <xsl:template match="p"> <p><xsl:apply-templates/></p> </xsl:template> <xsl:template match="br"> <br /> </xsl:template> <xsl:template match="strong"> <strong><xsl:apply-templates/></strong> </xsl:template> <xsl:template match="code"> <pre><code><xsl:apply-templates/></code></pre> </xsl:template> <xsl:template match="code[@class='xhtml']"> <span class="element"><xsl:apply-templates/></span> </xsl:template> <xsl:template match="note"> </xsl:template> </xsl:stylesheet>
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: xsl:if testing elements, David Carlisle | Thread | Re: XML/XSL on the client for dynam, Stefano Mazzocchi |
RE: if testing elements, Richard Lander | Date | Re: Select on Text Node, XML Out of, G. Ken Holman |
Month |