Mercurial > genshi > mirror
diff doc/xml-templates.txt @ 610:5e358de79e4c trunk
* XInclude elements in markup templates now support the `parse` attribute; when set to "xml" (the default), the include is processed as before, but when set to "text", the included template is parsed as a text template using the new syntax (ticket #101).
* If an include is found when parsing a template, but no template loader has been specified, a `TemplateSyntaxError` is raised.
author | cmlenz |
---|---|
date | Mon, 27 Aug 2007 23:20:47 +0000 |
parents | d7b957e92ea9 |
children | 3d2909fe1dda |
line wrap: on
line diff
--- a/doc/xml-templates.txt +++ b/doc/xml-templates.txt @@ -601,6 +601,10 @@ .. _`xinclude specification`: http://www.w3.org/TR/xinclude/ + +Dynamic Includes +================ + Incudes in Genshi are fully dynamic: Just like normal attributes, the `href` attribute accepts expressions, and directives_ can be used on the ``<xi:include />`` element just as on any other element, meaning you can do @@ -612,6 +616,23 @@ py:for="name in ('foo', 'bar', 'baz')" /> +Including Text Templates +======================== + +The ``parse`` attribute of the ``<xi:include>`` element can be used to specify +whether the included template is an XML template or a text template (using the +new syntax added in Genshi 0.5): + +.. code-block:: genshi + + <xi:include href="myscript.js" parse="text" /> + +This example would load the ``myscript.js`` file as a ``NewTextTemplate``. See +`text templates`_ for details on the syntax of text templates. + +.. _`text templates`: text-templates.html + + .. _comments: --------