[z3-checkins] r54980 - in z3/deliverance/sandboxes/paul: docs docs/_sources dvng dvng/step02 dvng/step03

paul at codespeak.net paul at codespeak.net
Tue May 20 02:40:45 CEST 2008


Author: paul
Date: Tue May 20 02:40:43 2008
New Revision: 54980

Added:
   z3/deliverance/sandboxes/paul/dvng/step02/content.xml   (contents, props changed)
Modified:
   z3/deliverance/sandboxes/paul/docs/_sources/index.txt
   z3/deliverance/sandboxes/paul/docs/_sources/step02.txt
   z3/deliverance/sandboxes/paul/docs/_sources/step03.txt
   z3/deliverance/sandboxes/paul/docs/index.html
   z3/deliverance/sandboxes/paul/docs/searchindex.json
   z3/deliverance/sandboxes/paul/docs/step02.html
   z3/deliverance/sandboxes/paul/docs/step03.html
   z3/deliverance/sandboxes/paul/dvng/index.rst
   z3/deliverance/sandboxes/paul/dvng/step02.rst
   z3/deliverance/sandboxes/paul/dvng/step02/dvfinalstage.xsl   (props changed)
   z3/deliverance/sandboxes/paul/dvng/step03.rst
   z3/deliverance/sandboxes/paul/dvng/step03/compiler.xsl
Log:
Fix inconsistencies

Modified: z3/deliverance/sandboxes/paul/docs/_sources/index.txt
==============================================================================
--- z3/deliverance/sandboxes/paul/docs/_sources/index.txt	(original)
+++ z3/deliverance/sandboxes/paul/docs/_sources/index.txt	Tue May 20 02:40:43 2008
@@ -2,17 +2,18 @@
 DVNG - Rewriting the XSLT Renderer
 ===========================================
 
-Deliverance is a simple system for applying a common look-and-feel to all
-pages across site, no matter what system generated the pages. Currently,
-Deliverance has two modes it uses to render:
+Deliverance is a simple system for applying a common look-and-feel to
+all pages across a site, no matter what system generated the pages.
+Currently, Deliverance has two modes it uses to render:
 
   - The Python Renderer uses lxml to manipulate HTML node trees during a
     request. This is the default renderer and the most supported.
 
-  - The XSLT Renderer generates an XSLT stylesheet that is applied to the
-    content, transforming the content page into a themed result. For this
-    renderer, XSLT is nothing but an internal, intermediate language:
-    Deliverance integrators need never see a single line of XSLT.
+  - The XSLT Renderer generates an XSLT stylesheet that is applied to
+    the content, transforming the content page into a themed result. For
+    this renderer, XSLT is nothing but an internal, intermediate
+    language: Deliverance integrators need never see a single line of
+    XSLT.
 
 DVNG is an experiment in rewriting the XSLT Renderer to achieve some new
 goals, while also prototyping the redesign of the Deliverance
@@ -26,10 +27,10 @@
 debugged chunks, using a combination of Pythonic lxml programming and
 XSLT transformation to produce the final stage.
 
-This final stage can be run with any XSLT processor and is no longer tied
-to the original theme, rules, or Deliverance processing logic. Stated
-differently, the final stage could be checked into Subversion and used
-without even installing Deliverance on a production server.
+This final stage can be run with any XSLT processor and is no longer
+tied to the original theme, rules, or Deliverance processing logic.
+Stated differently, the final stage could be checked into Subversion and
+used without even installing Deliverance on a production server.
 
 The goals include:
 
@@ -38,17 +39,22 @@
   usable not just between requests, but for as long as the theme and
   rules do not change.
 
-- *Reliability*.  Much less complex.
+- *Reliability*.  The production renderer is much less complex.
 
-- *Debuggability*.
-
-- *Extensibility*.
+- *Debuggability*. By making each stage of the rendering introspectable
+  in a "view source" fashion, you get some of the benefits of a
+  pipeline. Namely, you know what part of the process broke down.
+
+- *Extensibility*. Custom Deliverance rules, and even full-scale
+  extensions via imported XSLT, provide ways to make specialized changes
+  to the themes, rules, or even incoming content. All without adding
+  more features to Deliverance.
 
 About This Document
 ---------------------------
 
-This walkthrough is aimed first at the Deliverance mailing list, where we
-are considering design of the new specification and implementations.
+This walkthrough is aimed first at the Deliverance mailing list, where
+we are considering design of the new specification and implementations.
 
 As such, we'll gradually build the result, step by step, to show the
 thinking that went into this approach. In some ways, this is an advocacy

Modified: z3/deliverance/sandboxes/paul/docs/_sources/step02.txt
==============================================================================
--- z3/deliverance/sandboxes/paul/docs/_sources/step02.txt	(original)
+++ z3/deliverance/sandboxes/paul/docs/_sources/step02.txt	Tue May 20 02:40:43 2008
@@ -50,7 +50,10 @@
 
 This stage expects the theme file to have some "hints" in it. Namely, we
 expect an earlier stage to have found and marked the nodes in the theme
-that were matched by a rule's @themeid attribute. As an example::
+that were matched by a rule's @themeid attribute. This serves the DVNG
+goal of simplification: break work into smaller, simpler chunks.
+
+As an example::
 
   <h1 id="pageheading" dv:ruleid="1" dv:ruletype="replace">Theme 
   Page Heading</h1>
@@ -165,6 +168,11 @@
 This is the output we expected: the ``<h1>`` gets its value from the
 content page instead of the theme.
 
+Finally, you can open `an XML version of the content page
+<../dvng/step02/content.xml>`_ in Firefox 3.0 or Safari and see how the
+XSLT will transform the result. (Use View Source to see the unthemed
+content page.)
+
 Python For First Stage
 ------------------------------
 
@@ -188,4 +196,31 @@
 This has plenty of docstrings and comments, but let's walk through the
 lines:
 
-#. **Line 4-6**.  Setup some XML namespace-oriented constants.
+#. 	**Lines 4-6**.  Setup some XML namespace-oriented constants.
+
+#. 	**Lines 8-45**. Make a class that produces a reusable theme 
+   	processor.
+
+#. 	**Line 16-17**. Load the companion XSLT ``compiler.xsl``. This
+   	operates on the theme to produce the ``dvfinalstage.xsl`` "compiled
+	themeset."
+
+#.	**Lines 20-21**. Grab the theme and the rules file.
+
+#. 	**Lines 25-32**. For each rule, find the theme node that it points 
+	at and add some "hints" to the theme node. These hints help the
+	``compiler.xsl`` iterate over all the nodes in the theme, find the
+	places that have rules, and go find the right handler to generate a
+	rule.
+	
+#. 	**Lines 35-36**. Run the compiler on the hinted theme to produce the
+ 	final XSLT document, then turn it into a processor.  This is the 
+	final stage.  The processor can then be used over and over against 
+	outgoing content pages.
+	
+#.	**Lines 38-45**.  Read a content page into an etree and run the 
+	processor against it.  Return a string for the HTML of the themed 
+	content page.
+
+Running this Python module from the ``step02`` directory produces the
+same result as running ``xsltproc`` in Step 01.

Modified: z3/deliverance/sandboxes/paul/docs/_sources/step03.txt
==============================================================================
--- z3/deliverance/sandboxes/paul/docs/_sources/step03.txt	(original)
+++ z3/deliverance/sandboxes/paul/docs/_sources/step03.txt	Tue May 20 02:40:43 2008
@@ -22,6 +22,12 @@
 To do this, we'll gradually build up the support working backwards from
 the "compiled themeset".
 
+.. note::
+
+	This step re-thinks the decisions made in Step 02. I left Step 02 
+	as it was, though, to show the thought process.
+
+
 Sample Data and Desired Output
 ----------------------------------------
 
@@ -266,10 +272,56 @@
 	:language: python
 	:linenos:
 
+We'll let the docstrings and comments provide the explanation. At a high
+level, though:
+
+- Copy all the HTML for each theme directly into the rule file. The
+  compiler will then operate on this "compiled" rule file.
+
+- Add hints to the themes as before, but also, add id attributes to each
+  rule. This makes the ``compiler.xsl`` simpler when doing "joining" a
+  theme node to the rule that matched it.
+
 Here is the new compiler file:
 
 .. literalinclude:: step03/compiler.xsl
 	:language: xslt
 	:linenos:
 
+Again, we'll let the XML comments provide most of the documentation. The
+changes require some high-level explanation:
+
+- Inside the variable, iterate over the theme nodes.
+
+- For those, copy over everything that isn't flagged as part of a rule.
+
+- For things that are part of a rule, pass control to a rule handler
+  (e.g. Line 70)
+
+Running the module against one of the sample content pages is easy::
+
+	$ python ./xform.py content2.html 
+	<html>
+	<head>
+	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+	<title>Second Theme Page Title</title>
+	</head>
+	<body><table border="0"><tr>
+	<td><h2>Navigation</h2></td>
+	<td>
+	<h1>A Deeper Look At DVNG</h1>
+	<div id="pagecontent">Theme content to replace.</div>
+	</td>
+	</tr></table></body>
+	</html>
 
+Note that, since the module runs the debug method, we get ``xxx-cr.xml``
+and ``xxx-dvfinalstage.xsl`` output files. We can use these for
+introspection to confirm that we're getting what we expect. Tools like
+oXygen can then help run the transforms step by step, validate the
+stages, and even set breakpoints in a debugger.
+
+Finally, you can load `an XML version of the content page
+<../dvng/step03/content2.xml>`_ with the table-based theme, letting Firefox 3 or
+Safari perform the XSLT transform on the client. Again, use View Source
+to see the unthemed content page.
\ No newline at end of file

Modified: z3/deliverance/sandboxes/paul/docs/index.html
==============================================================================
--- z3/deliverance/sandboxes/paul/docs/index.html	(original)
+++ z3/deliverance/sandboxes/paul/docs/index.html	Tue May 20 02:40:43 2008
@@ -36,17 +36,18 @@
   
   <div class="section">
 <h1 id="dvng-rewriting-the-xslt-renderer">DVNG - Rewriting the XSLT Renderer<a class="headerlink" href="#dvng-rewriting-the-xslt-renderer" title="Permalink to this headline">¶</a></h1>
-<p>Deliverance is a simple system for applying a common look-and-feel to all
-pages across site, no matter what system generated the pages. Currently,
-Deliverance has two modes it uses to render:</p>
+<p>Deliverance is a simple system for applying a common look-and-feel to
+all pages across a site, no matter what system generated the pages.
+Currently, Deliverance has two modes it uses to render:</p>
 <blockquote>
 <ul class="simple">
 <li>The Python Renderer uses lxml to manipulate HTML node trees during a
 request. This is the default renderer and the most supported.</li>
-<li>The XSLT Renderer generates an XSLT stylesheet that is applied to the
-content, transforming the content page into a themed result. For this
-renderer, XSLT is nothing but an internal, intermediate language:
-Deliverance integrators need never see a single line of XSLT.</li>
+<li>The XSLT Renderer generates an XSLT stylesheet that is applied to
+the content, transforming the content page into a themed result. For
+this renderer, XSLT is nothing but an internal, intermediate
+language: Deliverance integrators need never see a single line of
+XSLT.</li>
 </ul>
 </blockquote>
 <p>DVNG is an experiment in rewriting the XSLT Renderer to achieve some new
@@ -58,25 +59,30 @@
 XSLT stylesheet. The stages break the work into smaller, more easily
 debugged chunks, using a combination of Pythonic lxml programming and
 XSLT transformation to produce the final stage.</p>
-<p>This final stage can be run with any XSLT processor and is no longer tied
-to the original theme, rules, or Deliverance processing logic. Stated
-differently, the final stage could be checked into Subversion and used
-without even installing Deliverance on a production server.</p>
+<p>This final stage can be run with any XSLT processor and is no longer
+tied to the original theme, rules, or Deliverance processing logic.
+Stated differently, the final stage could be checked into Subversion and
+used without even installing Deliverance on a production server.</p>
 <p>The goals include:</p>
 <ul class="simple">
 <li><em>Speed</em>. The current Deliverance renderers do a lot of work on each
 request. DVNG plans to do a lot of work once, with the result being
 usable not just between requests, but for as long as the theme and
 rules do not change.</li>
-<li><em>Reliability</em>.  Much less complex.</li>
-<li><em>Debuggability</em>.</li>
-<li><em>Extensibility</em>.</li>
+<li><em>Reliability</em>.  The production renderer is much less complex.</li>
+<li><em>Debuggability</em>. By making each stage of the rendering introspectable
+in a &#8220;view source&#8221; fashion, you get some of the benefits of a
+pipeline. Namely, you know what part of the process broke down.</li>
+<li><em>Extensibility</em>. Custom Deliverance rules, and even full-scale
+extensions via imported XSLT, provide ways to make specialized changes
+to the themes, rules, or even incoming content. All without adding
+more features to Deliverance.</li>
 </ul>
 </div>
 <div class="section">
 <h2 id="about-this-document">About This Document<a class="headerlink" href="#about-this-document" title="Permalink to this headline">¶</a></h2>
-<p>This walkthrough is aimed first at the Deliverance mailing list, where we
-are considering design of the new specification and implementations.</p>
+<p>This walkthrough is aimed first at the Deliverance mailing list, where
+we are considering design of the new specification and implementations.</p>
 <p>As such, we&#8217;ll gradually build the result, step by step, to show the
 thinking that went into this approach. In some ways, this is an advocacy
 document, meant not just to explain, but also to persuade. Apologies in

Modified: z3/deliverance/sandboxes/paul/docs/searchindex.json
==============================================================================
--- z3/deliverance/sandboxes/paul/docs/searchindex.json	(original)
+++ z3/deliverance/sandboxes/paul/docs/searchindex.json	Tue May 20 02:40:43 2008
@@ -1 +1 @@
-[["index","step02","step03","step01"],["DVNG - Rewriting the XSLT Renderer","Step 02 - A &#8220;Compiler&#8221; for DVNG","Step 03 - Multi-theme support","Step 01 - The Minimum"],{"all":[0,1,2],"code":[],"consider":[2],"messi":[2],"prefix":[1,2],"dirnam":[2],"go":[1],"follow":[3,2],"disk":[1,2],"children":[1],"millisecond":[2],"intermedi":[0,2],"send":[3],"articl":[2],"to":[0,1,2,3],"program":[0],"ti":[0],"td":[2],"nodeset":[3],"spec":[2],"introduc":[3,2],"sourc":[3,2],"string":[2],"getrul":[1,2],"far":[2],"getpar":[2],"theme2":[2],"veri":[3,2],"retriev":[2],"look":[0,1,2,3],"wa":[1],"did":[3],"list":[0],"iter":[1],"try":[3,1],"p":[3,1,2],"tostr":[2],"small":[1],"div":[3,1,2],"setup":[1],"dv_namespac":[1,2],"themeswitch":[2],"the":[0,1,2,3],"smaller":[0],"xsltproc":[0,1,2,3],"multithem":[2],"second":[2],"design":[0],"pass":[3,1,2],"further":[3],"append":[1,2],"even":[0],"trick":[3,1],"what":[0,1,2,3],"navig":[2],"section":[3,2],"introspect":[2],"abl":[2],"current":[0,1],"version":[0,1,2,3],"new":[0,2],"method":[1,2],"full":[2],"chose":[2],"gener":[0,1,2,3],"never":[0],"compilerfn":[1,2],"here":[3,1,2],"bodi":[3,1,2],"let":[3,1,2],"debugg":[0],"layout":[2],"along":[2],"strong":[],"interpret":[1],"box":[3],"convert":[1],"produc":[0,1,3],"33":[2],"32":[1],"37":[1],"35":[1],"34":[1],"advocaci":[0],"chang":[0,2],"head":[3,1,2],"semant":[2],"via":[2],"firefox":[0,3],"appli":[0,1,2,3],"modul":[2],"ask":[2],"href":[2],"instal":[0],"select":[3,1,2],"domain_url":[2],"would":[3],"0":[0,1,2,3],"two":[0,1],"contentfn":[1,2],"subvers":[0],"stylesheet":[0,1,2,3],"handler":[2],"call":[2],"usr":[3,1],"6":[3,1],"paramet":[2],"type":[3,1,2],"more":[0,1,2],"desir":[0,1,2,3],"themenod":[1,2],"relax":[2],"abspath":[2],"under":[3,2],"it":[0,1,2,3],"visual":[3],"prototyp":[0],"known":[3],"hold":[3],"me":[2],"none":[2],"join":[2],"f":[2],"1999":[3,1,2],"alia":[1,2],"prepar":[3],"work":[0,1,2,3],"subel":[2],"contentdoc":[3,1,2],"tag":[1,2],"can":[0,1,2,3],"ms":[3],"dvfinalstag":[3,1,2],"compilethem":[1],"root":[2],"def":[3,1,2],"boilerpl":[1],"control":[3,1,2],"heart":[1],"process":[0,1,2,3],"templat":[3,1,2],"topic":[2],"minimum":[0,1,3],"want":[0,1,2,3],"pagecont":[2],"openplan":[1,2],"lxml":[0,1,2,3],"multipl":[2],"goal":[0,1,2],"turn":[3,1,2],"charset":[3,1,2],"occur":[2],"1":[3,1,2],"how":[3,1,2],"_loadthem":[2],"instead":[3,1,2],"simpl":[0,1,2,3],"css":[3],"map":[1,2],"product":[0,3],"pagehead":[3,1,2],"w":[2],"referenc":[2],"earlier":[3,1],"spot":[1],"usabl":[0,2],"befor":[1,2],"cours":[1],"_makethemehint":[2],"themehtml":[2],"data":[0,1,2,3],"a":[0,1,2,3],"sy":[2],"essenti":[1],"ani":[0,2],"bind":[1,2],"combin":[0,1],"predic":[2],"wink":[0],"switch":[0,2,3],"preced":[2],"so":[3,1,2],"allow":[2],"oper":[1,2],"help":[3,1,2],"gradual":[0,2,3],"over":[3,1],"becaus":[3],"through":[1,2],"flexibl":[2],"dynam":[1],"equiv":[3,1,2],"24":[1],"25":[3,1],"style":[2],"27":[1],"20":[3,2],"render":[0],"22":[2],"ll":[0,1,2,3],"28":[3,1],"complex":[0],"mail":[0],"main":[3,1,2],"numespac":[2],"easier":[2],"ly":[1],"then":[3,1,2],"them":[1,2],"return":[1,2],"python":[0,1,2,3],"ye":[1,2],"initi":[3],"break":[0],"safari":[3],"not":[0,2],"now":[1,2],"discuss":[3],"choic":[0,2],"somewher":[1],"name":[3,1,2],"oxygen":[2],"anyth":[1,2],"opera":[3],"easili":[0,1,2,3],"achiev":[0],"mode":[0,2,3],"each":[0,2],"debug":[0,2],"found":[1],"went":[0],"higher":[0],"side":[3],"mean":[2],"compil":[0,1,2,3],"replac":[3,1,2],"chunk":[0],"_writedoc":[2],"continu":[2],"meta":[3,1,2],"expect":[1,2],"our":[1,2],"orient":[1,2],"out":[1,2],"variabl":[3,1,2],"shown":[1],"goe":[1],"req":[2],"\u0153node":[],"content":[0,1,2,3],"rewrit":[0],"rf":[1],"somexpath":[1],"suitabl":[2],"7":[1,2],"print":[3,1,2],"correct":[2],"common":[0,1,2,3],"insid":[3],"advanc":[0],"manipul":[0],"step02":[1],"argv":[2],"standard":[1],"standalon":[0],"reason":[1],"base":[2],"put":[3,2],"org":[3,1,2],"basi":[2],"indent":[1,2],"g":[2],"fairli":[0],"could":[0,1],"keep":[1],"thing":[3],"perhap":[2],"ish":[2],"place":[1,2],"isn":[2],"outsid":[2],"summari":[2],"think":[0,1,3],"first":[0,1,2,3],"origin":[0,2],"major":[3],"directli":[0],"feel":[0],"onc":[0,1],"number":[3,1],"walkthrough":[0,1,2,3],"instruct":[3],"blank":[],"xp":[2],"open":[3,2],"primari":[2],"idea":[2],"step01":[3,1,2],"differ":[0,2],"step03":[2],"script":[3],"top":[3,2],"system":[0],"least":[3],"_expanduri":[2],"2":[0,1,2,3],"conveni":[1],"final":[0,1,2,3],"schema":[2],"ruletyp":[1,2],"xmln":[3,1,2],"option":[2],"themeid":[1],"namespac":[1,2],"tool":[2],"copi":[3,1,2],"pretty_print":[2],"took":[3],"specifi":[2],"htmlroot":[2],"part":[0,1,2],"pars":[3,2],"multistag":[0],"than":[1],"xform":[2],"serv":[2],"albeit":[1],"kind":[1,2],"12":[1],"15":[2],"14":[2],"keyword":[2],"16":[2],"19":[3],"rulesfn":[1],"tree":[0],"exampl":[1,2],"matter":[0,1,2],"r":[2],"str":[1],"were":[1],"posit":[1,2],"thu":[3],"browser":[3],"and":[0,1,2,3],"xpath":[3,1,2],"sai":[1],"anywher":[1],"raw":[2],"have":[3,1,2],"__main__":[3,1,2],"need":[0,1,2],"element":[1,2],"saw":[1],"imagin":[3],"inform":[2],"self":[1,2],"that":[0,1,2,3],"note":[3,2],"also":[0,1,2,3],"denomin":[3],"read":[1],"take":[3,1,2],"indic":[1,2],"environ":[2],"noth":[0,1,2,3],"singl":[0,2],"such":[0,2,3],"sure":[2],"plenti":[1],"though":[0,1,2,3],"mixtur":[3],"most":[0,1],"regular":[1],"artifact":[2],"why":[3],"content2":[2],"don":[2],"url":[2],"doc":[1,2],"into":[0,1,2,3],"later":[3,1,2],"nsmap":[1,2],"uri":[1,2],"doe":[3,1],"declar":[2],"kw":[2],"runtim":[3],"determin":[3],"wsgi":[2],"show":[0,3],"cheat":[2],"text":[3,1,2],"particularli":[2],"hack":[1,2],"longer":[0],"find":[1,2],"xml":[3,1,2],"onli":[3,2],"ha":[0,1,2],"locat":[2],"pretti":[3],"with":[0,1,2,3],"explain":[0,1,3],"state":[0],"should":[3,1,2],"theme":[0,1,2,3],"suppos":[1],"rich":[2],"__call__":[1,2],"8":[3,1,2],"local":[2],"meant":[0],"do":[0,1,2,3],"get":[1,2],"__file__":[2],"express":[1,2],"comipl":[],"aim":[0],"dyn":[1],"b":[2],"dv":[1,2],"requir":[0],"rulesuri":[2],"provid":[1,2],"integr":[0],"contain":[2],"x":[1,2],"grab":[3,1,2],"where":[0,1,2],"view":[3],"set":[3,1,2],"commandlin":[2],"apolog":[0],"see":[0,2,3],"w3":[3,1,2],"result":[0,1,2,3],"fail":[],"close":[2],"02":[0,1,2],"03":[0,2],"01":[0,1,2,3],"extend":[1,2],"pattern":[3],"someth":[2],"enumer":[],"3":[0,3],"between":[0,2],"import":[3,1,2],"experi":[0,3],"approach":[0],"across":[0],"attribut":[1,2],"we":[0,1,2,3],"kei":[2],"xslt":[0,1,2,3],"parturi":[2],"themeset":[0,1,2,3],"deliver":[0,1,2,3],"extens":[0,1,3],"come":[2],"addit":[1],"both":[2],"last":[2],"equal":[2],"against":[1,2],"etc":[1,2],"s":[3,1,2],"context":[2],"logic":[0,1],"com":[2],"_makeruleid":[2],"load":[1,2],"getroot":[2],"simpli":[3],"point":[3,1,2],"etre":[3,1,2],"overview":[0,1],"exsl":[3,1,2],"persuad":[0],"header":[2],"param":[2],"suppli":[2],"cr":[2],"assign":[2],"origrulesdoc":[2],"asdf":[],"ct":[3,1,2],"quit":[3,1,2],"ultim":[3],"addition":[3,1],"invert":[3],"py":[2],"mark":[1],"much":[0],"valu":[3,1,2],"certain":[2],"strategi":[1,2],"deeper":[2],"given":[1,2],"imag":[2],"xxx":[2],"argument":[2],"togeth":[2],"func":[1],"child":[2],"rulesdoc":[1],"an":[0,1,2,3],"those":[1],"case":[3,1,2],"multi":[0,2],"ident":[3],"dvuri":[1],"these":[1,2],"might":[0],"moduledir":[2],"act":[2],"will":[3,1,2],"defin":[1,2],"while":[0],"error":[],"fun":[1],"pack":[2],"bin":[3,1],"ve":[2],"almost":[1],"stringparam":[2],"is":[0,1,2,3],"tabl":[2],"herein":[0],"in":[0,1,2,3],"incom":[3],"ie":[3],"id":[3,1,2],"__init__":[1,2],"if":[3,1,2],"null":[2],"minim":[2],"perform":[3,2],"border":[2],"make":[3,1,2],"same":[1,2],"tr":[2],"funni":[1],"html":[0,1,2,3],"split":[1,2],"9":[1],"document":[0,1,2,3],"complet":[0],"http":[3,1,2],"effect":[0,3],"capabl":[2],"user":[2],"implement":[0,1,2],"recent":[0,3],"scenario":[2],"xsldoc":[3],"i":[2],"markup":[3],"49":[2],"well":[2],"without":[0,1],"client":[3],"command":[2],"thi":[0,1,2,3],"choos":[2],"everyth":[1,2],"left":[2],"comment":[1],"identifi":[2],"just":[0,1],"less":[0],"rulefil":[0,2],"fulluri":[2],"prepend":[1],"speed":[0],"languag":[0,2],"site":[0],"easi":[3,1],"hint":[0,1,2],"had":[3],"except":[1],"littl":[1],"adf":[],"add":[1,2],"other":[0,1,2,3],"4":[3,1,2],"els":[3,2],"save":[1],"match":[3,1,2],"build":[0,2],"8220":[1],"8221":[1],"which":[3,1,2],"handl":[3,1,2],"big":[1],"redesign":[0],"bit":[1,2],"walk":[1],"recurs":[3,1],"you":[0,1,2,3],"like":[3,1,2],"heredir":[2],"insert":[1,2],"d":[2],"specif":[0],"substr":[2],"server":[0],"t":[2],"output":[0,1,2,3],"page":[0,1,2,3],"xsl":[3,1,2],"www":[3,1,2],"right":[3,2],"finalstag":[1,2],"some":[0,1,2,3],"begin":[1],"10":[2],"ah":[1],"intern":[0],"dvng":[0,1,2,3],"sampl":[0,1,2,3],"rel":[2],"themefn":[1],"rulenum":[2],"for":[0,1,2,3],"ruleid":[1,2],"definit":[2],"per":[2],"leav":[2],"condit":[2],"themexpath":[1,2],"foo":[2],"complic":[1],"refer":[2],"be":[0,1,2],"plu":[2],"investig":[2],"run":[0,1,2,3],"compiledthem":[3,1,2],"step":[0,1,2,3],"nutshel":[0,3],"although":[2],"__name__":[3,1,2],"exslt":[3,1,2],"by":[0,1,2,3],"stage":[0,1,2,3],"on":[0,1,2,3],"about":[0,2],"column":[2],"of":[0,1,2,3],"compilerdoc":[1,2],"themeuri":[2],"_getnod":[2],"os":[2],"or":[0,2,3],"block":[],"plan":[0],"em":[2],"h2":[2],"around":[1],"h1":[3,1,2],"encod":[3,1,2],"wrap":[2],"next":[1,2],"your":[3],"merg":[2],"processor":[0,1,2,3],"log":[],"wai":[0,2,3],"support":[0,1,2,3],"there":[3,2],"unind":[],"transform":[0,1,2,3],"long":[0,3],"custom":[],"start":[3,1,2],"reli":[3],"trigger":[2],"includ":[0,2],"lot":[0,1,2],"biggest":[2],"function":[1,2],"from":[0,1,2,3],"themesourc":[2],"unexpect":[],"regard":[1],"but":[0,1,2],"back":[3,1],"translat":[2],"line":[0,1,2,3],"inlin":[],"true":[2],"codeblock":[],"0b5":[0,3],"utf":[3,1,2],"input":[3,1,2],"default":[0,2],"up":[1,2],"us":[0,1,2,3],"autocomplet":[2],"otherwis":[2],"problem":[3,1],"subordin":[2],"featur":[3,2],"constant":[1,2],"ad":[2],"creat":[3,1],"classic":[3],"request":[0,2],"dure":[0,2],"parser":[2],"filenam":[2],"repres":[2],"adsf":[],"as":[0,1,2,3],"ar":[0,1,2,3],"at":[0,1,2,3],"file":[0,1,2,3],"themedoc":[1],"path":[2],"check":[0],"graft":[2],"again":[1],"no":[0,2],"titl":[3,1,2],"absdir":[2],"when":[3,1,2],"elementtre":[3,1,2],"ng":[2],"end":[3,2],"valid":[2],"5":[1],"rememb":[1],"test":[2],"presum":[2],"webob":[2],"nice":[2],"node":[0,1,2,3],"repeat":[3,2],"class":[1,2],"docstr":[1],"consid":[0],"e":[2],"lead":[2],"directori":[1,2],"reliabl":[0],"rule":[0,1,2,3],"write":[3,2],"u":[],"time":[3],"backward":[3,1,2]}]
\ No newline at end of file
+[["index","step02","step03","step01"],["DVNG - Rewriting the XSLT Renderer","Step 02 - A &#8220;Compiler&#8221; for DVNG","Step 03 - Multi-theme support","Step 01 - The Minimum"],{"all":[0,1,2],"code":[],"consider":[2],"messi":[2],"prefix":[1,2],"dirnam":[2],"go":[1],"follow":[3,2],"disk":[1,2],"children":[1],"millisecond":[2],"re":[2],"intermedi":[0,2],"send":[3],"articl":[2],"to":[0,1,2,3],"program":[0],"decis":[2],"ti":[0],"td":[2],"nodeset":[3],"spec":[2],"introduc":[3,2],"suitabl":[2],"sourc":[0,1,2,3],"string":[1,2],"getrul":[1,2],"far":[2],"getpar":[2],"theme2":[2],"veri":[3,2],"retriev":[2],"look":[0,1,2,3],"wa":[1,2],"level":[2],"did":[3],"list":[0],"iter":[1,2],"try":[3,1],"p":[3,1,2],"small":[1],"div":[3,1,2],"setup":[1],"dv_namespac":[1,2],"themeswitch":[2],"the":[0,1,2,3],"smaller":[0,1],"xsltproc":[0,1,2,3],"multithem":[2],"direct":[],"second":[2],"design":[0],"pass":[3,1,2],"further":[3],"append":[1,2],"even":[0,2],"trick":[3,1],"what":[0,1,2,3],"navig":[2],"section":[3,2],"introspect":[0,2],"abl":[2],"current":[0,1],"version":[0,1,2,3],"new":[0,2],"method":[1,2],"full":[0,2],"chose":[2],"gener":[0,1,2,3],"never":[0],"compilerfn":[1,2],"here":[3,1,2],"bodi":[3,1,2],"let":[3,1,2],"debugg":[0,2],"layout":[2],"along":[2],"strong":[],"sinc":[2],"interpret":[1],"box":[3],"convert":[1],"38":[1],"33":[2],"32":[1],"37":[1],"36":[1],"35":[1],"34":[1],"advocaci":[0],"chang":[0,2],"semant":[2],"via":[0,2],"firefox":[0,1,2,3],"appli":[0,1,2,3],"modul":[1,2],"put":[3,2],"href":[2],"__name__":[3,1,2],"instal":[0],"select":[3,1,2],"from":[0,1,2,3],"would":[3],"0":[0,1,2,3],"two":[0,1],"contentfn":[1,2],"subvers":[0],"stylesheet":[0,1,2,3],"handler":[1,2],"call":[2],"usr":[3,1],"6":[3,1],"paramet":[2],"stage":[0,1,2,3],"type":[3,1,2],"more":[0,1,2],"desir":[0,1,2,3],"themenod":[1,2],"relax":[2],"abspath":[2],"under":[3,2],"site":[0],"visual":[3],"prototyp":[0],"broke":[0],"known":[3],"hold":[3],"me":[2],"high":[2],"none":[2],"join":[2],"f":[2],"1999":[3,1,2],"alia":[1,2],"prepar":[3],"work":[0,1,2,3],"subel":[2],"contentdoc":[3,1,2],"tag":[1,2],"can":[0,1,2,3],"ms":[3],"dvfinalstag":[3,1,2],"compilethem":[1],"root":[2],"def":[3,1,2],"boilerpl":[1],"control":[3,1,2],"heart":[1],"process":[0,1,2,3],"templat":[3,1,2],"topic":[2],"minimum":[0,1,3],"want":[0,1,2,3],"pagecont":[2],"openplan":[1,2],"lxml":[0,1,2,3],"multipl":[2],"goal":[0,1,2],"turn":[3,1,2],"produc":[0,1,3],"charset":[3,1,2],"occur":[2],"1":[3,1,2],"how":[3,1,2],"_loadthem":[2],"instead":[3,1,2],"simpl":[0,1,2,3],"css":[3],"map":[1,2],"product":[0,3],"pagehead":[3,1,2],"w":[2],"referenc":[2],"earlier":[3,1],"spot":[1],"usabl":[0,2],"befor":[1,2],"cours":[1],"_makethemehint":[2],"themehtml":[2],"data":[0,1,2,3],"a":[0,1,2,3],"sy":[2],"essenti":[1],"ani":[0,2],"bind":[1,2],"combin":[0,1],"predic":[2],"wink":[0],"switch":[0,2,3],"preced":[2],"so":[3,1,2],"allow":[2],"wind":[2],"oper":[1,2],"help":[3,1,2],"gradual":[0,2,3],"over":[3,1,2],"becaus":[3],"through":[1,2],"flexibl":[2],"dynam":[1],"equiv":[3,1,2],"24":[1],"25":[3,1],"style":[2],"27":[1],"20":[3,1,2],"21":[1],"22":[2],"ll":[0,1,2,3],"28":[3,1],"complex":[0],"mail":[0],"main":[3,1,2],"numespac":[2],"easier":[2],"ly":[1],"then":[3,1,2],"them":[1,2],"within":[2],"return":[1,2],"python":[0,1,2,3],"ye":[1,2],"initi":[3],"break":[0,1],"safari":[3,1,2],"not":[0,2],"now":[1,2],"discuss":[3],"choic":[0,2],"somewher":[1],"name":[0,1,2,3],"oxygen":[2],"anyth":[1,2],"opera":[3],"easili":[0,1,2,3],"achiev":[0],"mode":[0,2,3],"each":[0,1,2],"debug":[0,2],"found":[1],"went":[0],"higher":[0],"side":[3],"mean":[2],"compil":[0,1,2,3],"replac":[3,1,2],"chunk":[0,1],"_writedoc":[2],"idea":[2],"meta":[3,1,2],"expect":[1,2],"our":[1,2],"orient":[1,2],"special":[0],"out":[1,2],"variabl":[3,1,2],"shown":[1],"goe":[1],"req":[2],"\u0153node":[],"content":[0,1,2,3],"rewrit":[0],"rf":[1],"somexpath":[1],"lineno":[],"7":[1,2],"print":[3,1,2],"correct":[2],"common":[0,1,2,3],"insid":[3,2],"advanc":[0],"manipul":[0],"step02":[1],"argv":[2],"standard":[1],"standalon":[0],"reason":[1],"base":[2],"ask":[2],"org":[3,1,2],"basi":[2],"reusabl":[1],"indent":[1,2],"g":[2],"fairli":[0],"could":[0,1],"keep":[1],"thing":[3,2],"perhap":[2],"ish":[2],"place":[1,2],"isn":[2],"outsid":[2],"summari":[2],"think":[0,1,2,3],"first":[0,1,2,3],"origin":[0,2],"major":[3],"directli":[0,2],"feel":[0],"onc":[0,1],"number":[3,1],"walkthrough":[0,1,2,3],"instruct":[3],"blank":[],"xp":[2],"open":[3,1,2],"primari":[2],"step01":[3,1,2],"differ":[0,2],"step03":[2],"script":[3],"top":[3,2],"system":[0],"least":[3],"_expanduri":[2],"2":[0,1,2,3],"conveni":[1],"final":[0,1,2,3],"schema":[2],"ruletyp":[1,2],"xmln":[3,1,2],"option":[2],"themeid":[1],"namespac":[1,2],"tool":[2],"copi":[3,1,2],"pretty_print":[2],"took":[3],"specifi":[2],"htmlroot":[2],"part":[0,1,2],"pars":[3,2],"multistag":[0],"than":[1],"xform":[2],"serv":[1,2],"albeit":[1],"kind":[1,2],"12":[1],"15":[2],"14":[2],"keyword":[2],"16":[1,2],"19":[3],"rulesfn":[1],"tree":[0],"exampl":[1,2],"matter":[0,1,2],"r":[2],"str":[1],"were":[1],"posit":[1,2],"thu":[3],"browser":[3],"and":[0,1,2,3],"xpath":[3,1,2],"sai":[1],"fashion":[0],"anywher":[1],"raw":[2],"have":[3,1,2],"__main__":[3,1,2],"need":[0,1,2],"element":[1,2],"saw":[1],"imagin":[3],"inform":[2],"self":[1,2],"that":[0,1,2,3],"note":[3,2],"also":[0,1,2,3],"denomin":[3],"take":[3,1,2],"indic":[1,2],"environ":[2],"noth":[0,1,2,3],"singl":[0,2],"pipelin":[0],"sure":[2],"plenti":[1],"though":[0,1,2,3],"mixtur":[3],"most":[0,1,2],"render":[0],"regular":[1],"artifact":[2],"70":[2],"why":[3],"content2":[2],"don":[2],"simplif":[1],"url":[2],"doc":[1,2],"into":[0,1,2,3],"later":[3,1,2],"request":[0,2],"uri":[1,2],"doe":[3,1],"declar":[2],"kw":[2],"runtim":[3],"determin":[3],"wsgi":[2],"show":[0,2,3],"cheat":[2],"text":[3,1,2],"particularli":[2],"hack":[1,2],"longer":[0],"find":[1,2],"xml":[3,1,2],"onli":[3,2],"ha":[0,1,2],"locat":[2],"pretti":[3],"with":[0,1,2,3],"explain":[0,1,3],"such":[0,2,3],"should":[3,1,2],"theme":[0,1,2,3],"suppos":[1],"rich":[2],"__call__":[1,2],"8":[3,1,2],"local":[2],"unthem":[1,2],"meant":[0],"do":[0,1,2,3],"get":[0,1,2],"__file__":[2],"express":[1,2],"comipl":[],"aim":[0],"dyn":[1],"b":[2],"dv":[1,2],"requir":[0,2],"17":[1],"rulesuri":[2],"provid":[0,1,2],"integr":[0],"contain":[2],"x":[1,2],"grab":[3,1,2],"where":[0,1,2],"view":[0,1,2,3],"set":[3,1,2],"commandlin":[2],"apolog":[0],"up":[1,2],"see":[0,1,2,3],"w3":[3,1,2],"result":[0,1,2,3],"fail":[],"close":[2],"02":[0,1,2],"03":[0,2],"01":[0,1,2,3],"extend":[1,2],"pattern":[3],"someth":[2],"enumer":[],"3":[0,1,2,3],"literalinclud":[],"between":[0,2],"it":[0,1,2,3],"import":[0,1,2,3],"experi":[0,3],"approach":[0],"across":[0],"attribut":[1,2],"we":[0,1,2,3],"kei":[2],"xslt":[0,1,2,3],"parturi":[2],"themeset":[0,1,2,3],"deliver":[0,1,2,3],"extens":[0,1,3],"come":[2],"addit":[1],"both":[2],"last":[2],"equal":[2],"against":[1,2],"etc":[1,2],"s":[3,1,2],"context":[2],"logic":[0,1],"might":[0],"com":[2],"_makeruleid":[2],"load":[1,2],"getroot":[2],"simpli":[3],"point":[3,1,2],"etre":[3,1,2],"overview":[0,1],"exsl":[3,1,2],"persuad":[0],"header":[2],"param":[2],"suppli":[2],"cr":[2],"assign":[2],"origrulesdoc":[2],"asdf":[],"ct":[3,1,2],"quit":[3,1,2],"ultim":[3],"addition":[3,1],"invert":[3],"py":[2],"mark":[1],"much":[0],"valu":[3,1,2],"ah":[1],"strategi":[1,2],"deeper":[2],"given":[1,2],"imag":[2],"xxx":[2],"argument":[2],"togeth":[2],"func":[1],"child":[2],"rulesdoc":[1],"an":[0,1,2,3],"those":[1,2],"case":[3,1,2],"multi":[0,2],"ident":[3],"dvuri":[1],"these":[1,2],"tostr":[2],"moduledir":[2],"act":[2],"will":[3,1,2],"defin":[1,2],"while":[0],"error":[],"fun":[1],"pack":[2],"bin":[3,1],"ve":[2],"almost":[1],"stringparam":[2],"is":[0,1,2,3],"tabl":[2],"herein":[0],"in":[0,1,2,3],"incom":[0,3],"ie":[3],"id":[3,1,2],"__init__":[1,2],"if":[3,1,2],"null":[2],"minim":[2],"perform":[3,2],"border":[2],"make":[0,1,2,3],"same":[1,2],"tr":[2],"funni":[1],"html":[0,1,2,3],"split":[1,2],"9":[1],"document":[0,1,2,3],"complet":[0],"finish":[2],"http":[3,1,2],"effect":[0,3],"companion":[1],"capabl":[2],"user":[2],"implement":[0,1,2],"recent":[0,3],"scenario":[2],"xsldoc":[3],"i":[2],"markup":[3],"49":[2],"well":[2],"without":[0,1],"thought":[2],"client":[3,2],"command":[2],"thi":[0,1,2,3],"choos":[2],"everyth":[1,2],"left":[2],"explan":[2],"comment":[1,2],"absdir":[2],"identifi":[2],"just":[0,1],"less":[0],"rulefil":[0,2],"fulluri":[2],"prepend":[1],"speed":[0,2],"languag":[0,2],"easi":[3,1,2],"hint":[0,1,2],"had":[3],"except":[1],"littl":[1],"adf":[],"add":[1,2],"other":[0,1,2,3],"4":[3,1,2],"els":[3,2],"save":[1],"match":[3,1,2],"build":[0,2],"8220":[1],"8221":[1],"which":[3,1,2],"read":[1],"big":[1],"know":[0],"redesign":[0],"bit":[1,2],"walk":[1],"recurs":[3,1],"you":[0,1,2,3],"like":[3,1,2],"heredir":[2],"insert":[1,2],"d":[2],"specif":[0],"substr":[2],"server":[0],"benefit":[0],"t":[2],"output":[0,1,2,3],"page":[0,1,2,3],"xsl":[3,1,2],"www":[3,1,2],"right":[3,1,2],"finalstag":[1,2],"some":[0,1,2,3],"begin":[1],"10":[2],"intern":[0],"dvng":[0,1,2,3],"sampl":[0,1,2,3],"rel":[2],"themefn":[1],"scale":[0],"rulenum":[2],"for":[0,1,2,3],"ruleid":[1,2],"definit":[2],"per":[2],"outgo":[1],"leav":[2],"condit":[2],"themexpath":[1,2],"foo":[2],"complic":[1],"refer":[2],"be":[0,1,2],"plu":[2],"investig":[2],"run":[0,1,2,3],"compiledthem":[3,1,2],"step":[0,1,2,3],"nutshel":[0,3],"although":[2],"nsmap":[1,2],"domain_url":[2],"exslt":[3,1,2],"by":[0,1,2,3],"simpler":[1,2],"continu":[2],"on":[0,1,2,3],"about":[0,2],"column":[2],"of":[0,1,2,3],"compilerdoc":[1,2],"themeuri":[2],"_getnod":[2],"os":[2],"or":[0,1,2,3],"block":[],"plan":[0],"em":[2],"h2":[2],"around":[1],"h1":[3,1,2],"encod":[3,1,2],"down":[0],"wrap":[2],"next":[1,2],"your":[3],"merg":[2],"processor":[0,1,2,3],"log":[],"wai":[0,2,3],"support":[0,1,2,3],"there":[3,2],"unind":[],"transform":[0,1,2,3],"long":[0,3],"custom":[0],"start":[3,1,2],"reli":[3],"trigger":[2],"includ":[0,2],"lot":[0,1,2],"biggest":[2],"function":[1,2],"head":[3,1,2],"themesourc":[2],"unexpect":[],"handl":[3,1,2],"regard":[1],"but":[0,1,2],"back":[3,1],"state":[0],"translat":[2],"breakpoint":[2],"line":[0,1,2,3],"inlin":[],"true":[2],"codeblock":[],"0b5":[0,3],"made":[2],"utf":[3,1,2],"input":[3,1,2],"default":[0,2],"maximum":[],"us":[0,1,2,3],"autocomplet":[2],"otherwis":[2],"problem":[3,1],"subordin":[2],"featur":[0,2,3],"constant":[1,2],"ad":[0,2],"creat":[3,1],"classic":[3],"certain":[2],"dure":[0,2],"parser":[2],"filenam":[2],"repres":[2],"adsf":[],"as":[0,1,2,3],"ar":[0,1,2,3],"at":[0,1,2,3],"file":[0,1,2,3],"themedoc":[1],"path":[2],"check":[0],"graft":[2],"again":[1,2],"no":[0,2],"titl":[3,1,2],"45":[1],"when":[3,1,2],"elementtre":[3,1,2],"ng":[2],"end":[3,2],"valid":[2],"5":[1],"rememb":[1],"test":[2],"presum":[2],"webob":[2],"nice":[2],"node":[0,1,2,3],"repeat":[3,2],"class":[1,2],"docstr":[1,2],"consid":[0],"e":[2],"lead":[2],"directori":[1,2],"reliabl":[0],"confirm":[2],"flag":[2],"rule":[0,1,2,3],"write":[3,2],"u":[],"time":[3],"backward":[3,1,2]}]
\ No newline at end of file

Modified: z3/deliverance/sandboxes/paul/docs/step02.html
==============================================================================
--- z3/deliverance/sandboxes/paul/docs/step02.html	(original)
+++ z3/deliverance/sandboxes/paul/docs/step02.html	Tue May 20 02:40:43 2008
@@ -87,7 +87,9 @@
 </ul>
 <p>This stage expects the theme file to have some &#8220;hints&#8221; in it. Namely, we
 expect an earlier stage to have found and marked the nodes in the theme
-that were matched by a rule&#8217;s &#64;themeid attribute. As an example:</p>
+that were matched by a rule&#8217;s &#64;themeid attribute. This serves the DVNG
+goal of simplification: break work into smaller, simpler chunks.</p>
+<p>As an example:</p>
 <pre>&lt;h1 id="pageheading" dv:ruleid="1" dv:ruletype="replace"&gt;Theme
 Page Heading&lt;/h1&gt;</pre>
 <p>This adds two attributes to the spot in the theme where a rule should
@@ -268,6 +270,9 @@
 &lt;/html&gt;</pre>
 <p>This is the output we expected: the <tt class="docutils literal"><span class="pre">&lt;h1&gt;</span></tt> gets its value from the
 content page instead of the theme.</p>
+<p>Finally, you can open <a class="reference" href="../dvng/step02/content.xml">an XML version of the content page</a> in Firefox 3.0 or Safari and see how the
+XSLT will transform the result. (Use View Source to see the unthemed
+content page.)</p>
 </div>
 <div class="section">
 <h2 id="python-for-first-stage">Python For First Stage<a class="headerlink" href="#python-for-first-stage" title="Permalink to this headline">¶</a></h2>
@@ -428,8 +433,28 @@
 </td></tr></table><p>This has plenty of docstrings and comments, but let&#8217;s walk through the
 lines:</p>
 <ol class="arabic simple">
-<li><strong>Line 4-6</strong>.  Setup some XML namespace-oriented constants.</li>
+<li><strong>Lines 4-6</strong>.  Setup some XML namespace-oriented constants.</li>
+<li><strong>Lines 8-45</strong>. Make a class that produces a reusable theme
+processor.</li>
+<li><strong>Line 16-17</strong>. Load the companion XSLT <tt class="docutils literal"><span class="pre">compiler.xsl</span></tt>. This
+operates on the theme to produce the <tt class="docutils literal"><span class="pre">dvfinalstage.xsl</span></tt> &#8220;compiled
+themeset.&#8221;</li>
+<li><strong>Lines 20-21</strong>. Grab the theme and the rules file.</li>
+<li><strong>Lines 25-32</strong>. For each rule, find the theme node that it points
+at and add some &#8220;hints&#8221; to the theme node. These hints help the
+<tt class="docutils literal"><span class="pre">compiler.xsl</span></tt> iterate over all the nodes in the theme, find the
+places that have rules, and go find the right handler to generate a
+rule.</li>
+<li><strong>Lines 35-36</strong>. Run the compiler on the hinted theme to produce the
+final XSLT document, then turn it into a processor.  This is the
+final stage.  The processor can then be used over and over against
+outgoing content pages.</li>
+<li><strong>Lines 38-45</strong>.  Read a content page into an etree and run the
+processor against it.  Return a string for the HTML of the themed
+content page.</li>
 </ol>
+<p>Running this Python module from the <tt class="docutils literal"><span class="pre">step02</span></tt> directory produces the
+same result as running <tt class="docutils literal"><span class="pre">xsltproc</span></tt> in Step 01.</p>
 </div>
 </div>
 

Modified: z3/deliverance/sandboxes/paul/docs/step03.html
==============================================================================
--- z3/deliverance/sandboxes/paul/docs/step03.html	(original)
+++ z3/deliverance/sandboxes/paul/docs/step03.html	Tue May 20 02:40:43 2008
@@ -56,6 +56,11 @@
 </ul>
 <p>To do this, we&#8217;ll gradually build up the support working backwards from
 the &#8220;compiled themeset&#8221;.</p>
+<div class="admonition note">
+<p class="first admonition-title">Note</p>
+<p class="last">This step re-thinks the decisions made in Step 02. I left Step 02
+as it was, though, to show the thought process.</p>
+</div>
 <div class="section">
 <h2 id="sample-data-and-desired-output">Sample Data and Desired Output<a class="headerlink" href="#sample-data-and-desired-output" title="Permalink to this headline">¶</a></h2>
 <p>For our main theme, we&#8217;ll continue using <tt class="docutils literal"><span class="pre">step01/theme.html</span></tt>. We&#8217;ll
@@ -725,7 +730,16 @@
 	<span class="n">result</span> <span class="o">=</span> <span class="n">main</span><span class="p">()</span>
 	<span class="k">print</span> <span class="n">result</span>
 </pre></div>
-</td></tr></table><p>Here is the new compiler file:</p>
+</td></tr></table><p>We&#8217;ll let the docstrings and comments provide the explanation. At a high
+level, though:</p>
+<ul class="simple">
+<li>Copy all the HTML for each theme directly into the rule file. The
+compiler will then operate on this &#8220;compiled&#8221; rule file.</li>
+<li>Add hints to the themes as before, but also, add id attributes to each
+rule. This makes the <tt class="docutils literal"><span class="pre">compiler.xsl</span></tt> simpler when doing &#8220;joining&#8221; a
+theme node to the rule that matched it.</li>
+</ul>
+<p>Here is the new compiler file:</p>
 <table class="highlighttable"><tr><td class="linenos"><pre>  1
   2
   3
@@ -828,12 +842,20 @@
 100
 101
 102
-103</pre></td><td class="code"><div class="highlight"><pre><span class="cp">&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;</span>
+103
+104
+105
+106
+107
+108</pre></td><td class="code"><div class="highlight"><pre><span class="cp">&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;</span>
 <span class="nt">&lt;x:stylesheet</span> <span class="na">xmlns:x=</span><span class="s">&quot;http://www.w3.org/1999/XSL/Transform&quot;</span>
     <span class="na">xmlns:dv=</span><span class="s">&quot;http://openplans.org/deliverance&quot;</span> <span class="na">xmlns:xsl=</span><span class="s">&quot;anything&quot;</span>
     <span class="na">xmlns:exsl=</span><span class="s">&quot;http://exslt.org/common&quot;</span> <span class="na">version=</span><span class="s">&quot;1.0&quot;</span><span class="nt">&gt;</span>
     <span class="nt">&lt;x:namespace-alias</span> <span class="na">stylesheet-prefix=</span><span class="s">&quot;xsl&quot;</span> <span class="na">result-prefix=</span><span class="s">&quot;x&quot;</span><span class="nt">/&gt;</span>
     <span class="nt">&lt;x:output</span> <span class="na">indent=</span><span class="s">&quot;yes&quot;</span> <span class="na">method=</span><span class="s">&quot;xml&quot;</span><span class="nt">/&gt;</span>
+    
+    <span class="c">&lt;!-- Make an XSL key to speed up when we need to &quot;join&quot; </span>
+<span class="c">    to find a rule from within a theme node&#39;s hint. --&gt;</span>
     <span class="nt">&lt;x:key</span> <span class="na">name=</span><span class="s">&quot;getRule&quot;</span> <span class="na">match=</span><span class="s">&quot;dv:replace&quot;</span> <span class="na">use=</span><span class="s">&quot;@id&quot;</span><span class="nt">/&gt;</span>
     <span class="nt">&lt;x:template</span> <span class="na">match=</span><span class="s">&quot;/&quot;</span><span class="nt">&gt;</span>
         <span class="k">&lt;xsl:stylesheet</span> <span class="na">xmlns:exsl=</span><span class="s">&quot;http://exslt.org/common&quot;</span> <span class="na">version=</span><span class="s">&quot;1.0&quot;</span><span class="nt">&gt;</span>
@@ -841,7 +863,9 @@
             <span class="nt">&lt;x:apply-templates</span> <span class="na">select=</span><span class="s">&quot;/*/*/dv:match/dv:req&quot;</span> <span class="na">mode=</span><span class="s">&quot;params&quot;</span><span class="nt">/&gt;</span>
             <span class="k">&lt;xsl:variable</span> <span class="na">name=</span><span class="s">&quot;compiledtheme&quot;</span><span class="nt">&gt;</span>
                 <span class="k">&lt;xsl:choose</span><span class="nt">&gt;</span>
-                    <span class="c">&lt;!-- Based on certain conditions, use one of the themes --&gt;</span>
+                    <span class="c">&lt;!-- Based on certain conditions, use one of the </span>
+<span class="c">                        themes. We&#39;ll wind up generating &lt;xsl:when&gt; </span>
+<span class="c">                        nodes then a finishing xsl:otherwise.--&gt;</span>
                     <span class="nt">&lt;x:apply-templates</span> <span class="na">select=</span><span class="s">&quot;/*/dv:theme&quot;</span><span class="nt">/&gt;</span>
                 <span class="k">&lt;/xsl:choose&gt;</span>
             <span class="k">&lt;/xsl:variable&gt;</span>
@@ -932,7 +956,38 @@
     <span class="nt">&lt;x:template</span> <span class="na">match=</span><span class="s">&quot;@ruleid|@ruletype&quot;</span><span class="nt">/&gt;</span>
 <span class="nt">&lt;/x:stylesheet&gt;</span>
 </pre></div>
-</td></tr></table></div>
+</td></tr></table><p>Again, we&#8217;ll let the XML comments provide most of the documentation. The
+changes require some high-level explanation:</p>
+<ul class="simple">
+<li>Inside the variable, iterate over the theme nodes.</li>
+<li>For those, copy over everything that isn&#8217;t flagged as part of a rule.</li>
+<li>For things that are part of a rule, pass control to a rule handler
+(e.g. Line 70)</li>
+</ul>
+<p>Running the module against one of the sample content pages is easy:</p>
+<pre>$ python ./xform.py content2.html
+&lt;html&gt;
+&lt;head&gt;
+&lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt;
+&lt;title&gt;Second Theme Page Title&lt;/title&gt;
+&lt;/head&gt;
+&lt;body&gt;&lt;table border="0"&gt;&lt;tr&gt;
+&lt;td&gt;&lt;h2&gt;Navigation&lt;/h2&gt;&lt;/td&gt;
+&lt;td&gt;
+&lt;h1&gt;A Deeper Look At DVNG&lt;/h1&gt;
+&lt;div id="pagecontent"&gt;Theme content to replace.&lt;/div&gt;
+&lt;/td&gt;
+&lt;/tr&gt;&lt;/table&gt;&lt;/body&gt;
+&lt;/html&gt;</pre>
+<p>Note that, since the module runs the debug method, we get <tt class="docutils literal"><span class="pre">xxx-cr.xml</span></tt>
+and <tt class="docutils literal"><span class="pre">xxx-dvfinalstage.xsl</span></tt> output files. We can use these for
+introspection to confirm that we&#8217;re getting what we expect. Tools like
+oXygen can then help run the transforms step by step, validate the
+stages, and even set breakpoints in a debugger.</p>
+<p>Finally, you can load <a class="reference" href="../dvng/step03/content2.xml">an XML version of the content page</a> with the table-based theme, letting Firefox 3 or
+Safari perform the XSLT transform on the client. Again, use View Source
+to see the unthemed content page.</p>
+</div>
 </div>
 
 

Modified: z3/deliverance/sandboxes/paul/dvng/index.rst
==============================================================================
--- z3/deliverance/sandboxes/paul/dvng/index.rst	(original)
+++ z3/deliverance/sandboxes/paul/dvng/index.rst	Tue May 20 02:40:43 2008
@@ -2,17 +2,18 @@
 DVNG - Rewriting the XSLT Renderer
 ===========================================
 
-Deliverance is a simple system for applying a common look-and-feel to all
-pages across site, no matter what system generated the pages. Currently,
-Deliverance has two modes it uses to render:
+Deliverance is a simple system for applying a common look-and-feel to
+all pages across a site, no matter what system generated the pages.
+Currently, Deliverance has two modes it uses to render:
 
   - The Python Renderer uses lxml to manipulate HTML node trees during a
     request. This is the default renderer and the most supported.
 
-  - The XSLT Renderer generates an XSLT stylesheet that is applied to the
-    content, transforming the content page into a themed result. For this
-    renderer, XSLT is nothing but an internal, intermediate language:
-    Deliverance integrators need never see a single line of XSLT.
+  - The XSLT Renderer generates an XSLT stylesheet that is applied to
+    the content, transforming the content page into a themed result. For
+    this renderer, XSLT is nothing but an internal, intermediate
+    language: Deliverance integrators need never see a single line of
+    XSLT.
 
 DVNG is an experiment in rewriting the XSLT Renderer to achieve some new
 goals, while also prototyping the redesign of the Deliverance
@@ -26,10 +27,10 @@
 debugged chunks, using a combination of Pythonic lxml programming and
 XSLT transformation to produce the final stage.
 
-This final stage can be run with any XSLT processor and is no longer tied
-to the original theme, rules, or Deliverance processing logic. Stated
-differently, the final stage could be checked into Subversion and used
-without even installing Deliverance on a production server.
+This final stage can be run with any XSLT processor and is no longer
+tied to the original theme, rules, or Deliverance processing logic.
+Stated differently, the final stage could be checked into Subversion and
+used without even installing Deliverance on a production server.
 
 The goals include:
 
@@ -38,17 +39,22 @@
   usable not just between requests, but for as long as the theme and
   rules do not change.
 
-- *Reliability*.  Much less complex.
+- *Reliability*.  The production renderer is much less complex.
 
-- *Debuggability*.
-
-- *Extensibility*.
+- *Debuggability*. By making each stage of the rendering introspectable
+  in a "view source" fashion, you get some of the benefits of a
+  pipeline. Namely, you know what part of the process broke down.
+
+- *Extensibility*. Custom Deliverance rules, and even full-scale
+  extensions via imported XSLT, provide ways to make specialized changes
+  to the themes, rules, or even incoming content. All without adding
+  more features to Deliverance.
 
 About This Document
 ---------------------------
 
-This walkthrough is aimed first at the Deliverance mailing list, where we
-are considering design of the new specification and implementations.
+This walkthrough is aimed first at the Deliverance mailing list, where
+we are considering design of the new specification and implementations.
 
 As such, we'll gradually build the result, step by step, to show the
 thinking that went into this approach. In some ways, this is an advocacy

Modified: z3/deliverance/sandboxes/paul/dvng/step02.rst
==============================================================================
--- z3/deliverance/sandboxes/paul/dvng/step02.rst	(original)
+++ z3/deliverance/sandboxes/paul/dvng/step02.rst	Tue May 20 02:40:43 2008
@@ -50,7 +50,10 @@
 
 This stage expects the theme file to have some "hints" in it. Namely, we
 expect an earlier stage to have found and marked the nodes in the theme
-that were matched by a rule's @themeid attribute. As an example::
+that were matched by a rule's @themeid attribute. This serves the DVNG
+goal of simplification: break work into smaller, simpler chunks.
+
+As an example::
 
   <h1 id="pageheading" dv:ruleid="1" dv:ruletype="replace">Theme 
   Page Heading</h1>
@@ -165,6 +168,11 @@
 This is the output we expected: the ``<h1>`` gets its value from the
 content page instead of the theme.
 
+Finally, you can open `an XML version of the content page
+<../dvng/step02/content.xml>`_ in Firefox 3.0 or Safari and see how the
+XSLT will transform the result. (Use View Source to see the unthemed
+content page.)
+
 Python For First Stage
 ------------------------------
 
@@ -188,4 +196,31 @@
 This has plenty of docstrings and comments, but let's walk through the
 lines:
 
-#. **Line 4-6**.  Setup some XML namespace-oriented constants.
+#. 	**Lines 4-6**.  Setup some XML namespace-oriented constants.
+
+#. 	**Lines 8-45**. Make a class that produces a reusable theme 
+   	processor.
+
+#. 	**Line 16-17**. Load the companion XSLT ``compiler.xsl``. This
+   	operates on the theme to produce the ``dvfinalstage.xsl`` "compiled
+	themeset."
+
+#.	**Lines 20-21**. Grab the theme and the rules file.
+
+#. 	**Lines 25-32**. For each rule, find the theme node that it points 
+	at and add some "hints" to the theme node. These hints help the
+	``compiler.xsl`` iterate over all the nodes in the theme, find the
+	places that have rules, and go find the right handler to generate a
+	rule.
+	
+#. 	**Lines 35-36**. Run the compiler on the hinted theme to produce the
+ 	final XSLT document, then turn it into a processor.  This is the 
+	final stage.  The processor can then be used over and over against 
+	outgoing content pages.
+	
+#.	**Lines 38-45**.  Read a content page into an etree and run the 
+	processor against it.  Return a string for the HTML of the themed 
+	content page.
+
+Running this Python module from the ``step02`` directory produces the
+same result as running ``xsltproc`` in Step 01.

Added: z3/deliverance/sandboxes/paul/dvng/step02/content.xml
==============================================================================
--- (empty file)
+++ z3/deliverance/sandboxes/paul/dvng/step02/content.xml	Tue May 20 02:40:43 2008
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?xml-stylesheet type="text/xsl" href="dvfinalstage.xsl"?>
+<div id="page-content">
+    <h1>DVNG Walkthrough</h1>
+</div>

Modified: z3/deliverance/sandboxes/paul/dvng/step03.rst
==============================================================================
--- z3/deliverance/sandboxes/paul/dvng/step03.rst	(original)
+++ z3/deliverance/sandboxes/paul/dvng/step03.rst	Tue May 20 02:40:43 2008
@@ -22,6 +22,12 @@
 To do this, we'll gradually build up the support working backwards from
 the "compiled themeset".
 
+.. note::
+
+	This step re-thinks the decisions made in Step 02. I left Step 02 
+	as it was, though, to show the thought process.
+
+
 Sample Data and Desired Output
 ----------------------------------------
 
@@ -266,12 +272,32 @@
 	:language: python
 	:linenos:
 
+We'll let the docstrings and comments provide the explanation. At a high
+level, though:
+
+- Copy all the HTML for each theme directly into the rule file. The
+  compiler will then operate on this "compiled" rule file.
+
+- Add hints to the themes as before, but also, add id attributes to each
+  rule. This makes the ``compiler.xsl`` simpler when doing "joining" a
+  theme node to the rule that matched it.
+
 Here is the new compiler file:
 
 .. literalinclude:: step03/compiler.xsl
 	:language: xslt
 	:linenos:
 
+Again, we'll let the XML comments provide most of the documentation. The
+changes require some high-level explanation:
+
+- Inside the variable, iterate over the theme nodes.
+
+- For those, copy over everything that isn't flagged as part of a rule.
+
+- For things that are part of a rule, pass control to a rule handler
+  (e.g. Line 70)
+
 Running the module against one of the sample content pages is easy::
 
 	$ python ./xform.py content2.html 
@@ -289,3 +315,13 @@
 	</tr></table></body>
 	</html>
 
+Note that, since the module runs the debug method, we get ``xxx-cr.xml``
+and ``xxx-dvfinalstage.xsl`` output files. We can use these for
+introspection to confirm that we're getting what we expect. Tools like
+oXygen can then help run the transforms step by step, validate the
+stages, and even set breakpoints in a debugger.
+
+Finally, you can load `an XML version of the content page
+<../dvng/step03/content2.xml>`_ with the table-based theme, letting Firefox 3 or
+Safari perform the XSLT transform on the client. Again, use View Source
+to see the unthemed content page.
\ No newline at end of file

Modified: z3/deliverance/sandboxes/paul/dvng/step03/compiler.xsl
==============================================================================
--- z3/deliverance/sandboxes/paul/dvng/step03/compiler.xsl	(original)
+++ z3/deliverance/sandboxes/paul/dvng/step03/compiler.xsl	Tue May 20 02:40:43 2008
@@ -4,6 +4,9 @@
     xmlns:exsl="http://exslt.org/common" version="1.0">
     <x:namespace-alias stylesheet-prefix="xsl" result-prefix="x"/>
     <x:output indent="yes" method="xml"/>
+    
+    <!-- Make an XSL key to speed up when we need to "join" 
+    to find a rule from within a theme node's hint. -->
     <x:key name="getRule" match="dv:replace" use="@id"/>
     <x:template match="/">
         <xsl:stylesheet xmlns:exsl="http://exslt.org/common" version="1.0">
@@ -11,7 +14,9 @@
             <x:apply-templates select="/*/*/dv:match/dv:req" mode="params"/>
             <xsl:variable name="compiledtheme">
                 <xsl:choose>
-                    <!-- Based on certain conditions, use one of the themes -->
+                    <!-- Based on certain conditions, use one of the 
+                        themes. We'll wind up generating <xsl:when> 
+                        nodes then a finishing xsl:otherwise.-->
                     <x:apply-templates select="/*/dv:theme"/>
                 </xsl:choose>
             </xsl:variable>


More information about the z3-checkins mailing list