Genshi XML Template Reference¶
Genshi’s XML templating language is used in Bundler for templated bundles. The language is described in depth at Genshi. The XML schema reference follows.
Genshi Tags¶
- group py:genshiElements¶
- Most Genshi templating directives can be used either as standalone elements or as attributes on existing elements. This element group defines the standalone tags.
- Elements:
- element py:with¶
-
- Attributes:
Name Description Values Required Default py:vars
A semicolon-delimited list of variables to define and their values.string
Yes None - Text content:
- Any
Any arbitrary child elements allowed
- element py:replace¶
-
- Attributes:
Name Description Values Required Default py:value
The value to replace the contents with.string
Yes None - Text content:
- Any
Any arbitrary child elements allowed
- element py:choose¶
-
- Attributes:
Name Description Values Required Default py:test
Iftest
is set, the childpy:when
directives are tested for equality to the value of the expression.string
No None - Child elements:
- element py:when¶
The
when
directive is used insidepy:chooseType
orchoose
to handle a single specific condition.- Attributes:
Name Description Values Required Default py:test
The statement giving the value to teststring
Yes None - Text content:
Any
Any arbitrary child elements allowed
- element py:otherwise¶
-
- Text content:
Any
Any arbitrary child elements allowed
- Text content:
- Any
- element py:for¶
-
- Attributes:
Name Description Values Required Default py:each
The loop iteratorstring
Yes None - Text content:
- Any
Any arbitrary child elements allowed
- element py:if¶
-
- Attributes:
Name Description Values Required Default py:test
The statement giving the value to teststring
Yes None - Text content:
- Any
Any arbitrary child elements allowed
- element py:match¶
-
- Attributes:
Name Description Values Required Default py:path
XPath expression to search for in the template.string
Yes None py:buffer
Whether the matched content should be buffered in memory. Buffering can improve performance a bit at the cost of needing more memory during rendering. Buffering is required for match templates that contain more than one invocation of theselect()
function. If there is only one call, and the matched content can potentially be very long, consider disabling buffering to avoid excessive memory use.true
|false
No true
py:once
Whether the engine should stop looking for more matching elements after the first match. Use this on match templates that match elements that can only occur once in the stream, such as the <head> or <body> elements in an HTML template, or elements with a specific ID.true
|false
No false
py:recursive
Whether the match template should be applied to its own output. Note that once implies non-recursive behavior, so this attribute only needs to be set for match templates that don’t also have once set.true
|false
No true
- Text content:
- Any
Any arbitrary child elements allowed
Genshi Attributes¶
- attributeGroup py:genshiAttrs¶
- Most Genshi templating directives can be used either as standalone elements or as attributes on existing elements. This attribute group defines the attribute directives.
Name Description Values Required Default py:attrs
string
No None py:choose
string
No None py:content
string
No None py:def
string
No None py:for
string
No None py:if
string
No None py:match
string
No None py:otherwise
Theotherwise
directive is used insidepy:chooseType
orchoose
to handle all conditions not handled by apy:when
.string
No None py:replace
string
No None py:strip
string
No None py:when
string
No None py:with
string
No None