691 | | Finally, this is an example for using a more complex XPath pattern. This `select()` incantation here returns a stream that contains all child elements of the original `<head>`, except for those elements that have the local name “title”. If we didn't add that predicate, the output stream would contain two `<title>` tags, and we don't want that. |
692 | | |
693 | | If you've done a bit of XSLT, match templates should look familiar. Otherwise, you may want to familiarize yourself with the basics of [http://en.wikipedia.org/wiki/XPath XPath 1]—note though that Genshi only implements a subset of the full spec as explained in [wiki:Documentation/xpath.html Using XPath in Genshi]. And just play around with match templates; at the core, the concept is actually very simple and consistent. |
694 | | |
695 | | Now we need to update the page templates: they no longer need the header and footer, and we'll have to include the `layout.html` file. For the inclusion, we add the namespace prefix for XInclude, and an `xi:include` element. |
| 691 | Finally, this is an example for using a more complex XPath pattern. This `select()` incantation here returns a stream that contains all child elements of the original `<head>`, except for those elements with the tag name “title”. If we didn't add that predicate, the output stream would contain two `<title>` tags. |
| 692 | |
| 693 | If you've done a bit of XSLT, match templates should look familiar. Otherwise, you may want to familiarize yourself with the basics of [http://en.wikipedia.org/wiki/XPath XPath 1]—but note that Genshi only implements a subset of the full spec as explained in [wiki:Documentation/xpath.html Using XPath in Genshi]. Just play around with match templates a bit; at the core, the concept is actually pretty simple and consistent. |
| 694 | |
| 695 | Now we need to update the page templates: they no longer need the header and footer, and we'll have to include the `layout.html` file so that the match templates are applied. For the inclusion, we add the namespace prefix for XInclude, and an `xi:include` element. |
722 | | You need to also change `submit.html` analogously. |
723 | | |
724 | | Talking of “layout”, you can see that we've added references to some static resources in the layout template: there's an embedded image as well as a linked stylesheet and javascript file. [http://svn.edgewall.org/repos/genshi/trunk/examples/tutorial/geddit/static Download] those files and put them in your `geddit/static/` directory. |
| 722 | Also change the `submit.html` template analogously, by adding the namespace prefix, the `<xi:include>` element, and by removing the header and footer `<div>`s. |
| 723 | |
| 724 | Speaking of “layout”, you can see that we've added references to some static resources in the layout template: there's an embedded image as well as a linked stylesheet and javascript file. [http://svn.edgewall.org/repos/genshi/trunk/examples/tutorial/geddit/static Download] those files and put them in your `geddit/static/` directory. |