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:varsA semicolon-delimited list of variables to define and their values.stringYes None - Text content:
- Any
Any arbitrary child elements allowed
- element py:replace¶
-
- Attributes:
Name Description Values Required Default py:valueThe value to replace the contents with.stringYes None - Text content:
- Any
Any arbitrary child elements allowed
- element py:choose¶
-
- Attributes:
Name Description Values Required Default py:testIftestis set, the childpy:whendirectives are tested for equality to the value of the expression.stringNo None - Child elements:
- element py:when¶
The
whendirective is used insidepy:chooseTypeorchooseto handle a single specific condition.- Attributes:
Name Description Values Required Default py:testThe statement giving the value to teststringYes 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:eachThe loop iteratorstringYes None - Text content:
- Any
Any arbitrary child elements allowed
- element py:if¶
-
- Attributes:
Name Description Values Required Default py:testThe statement giving the value to teststringYes None - Text content:
- Any
Any arbitrary child elements allowed
- element py:match¶
-
- Attributes:
Name Description Values Required Default py:pathXPath expression to search for in the template.stringYes None py:bufferWhether 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|falseNo truepy:onceWhether 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|falseNo falsepy:recursiveWhether 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|falseNo 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:attrsstringNo None py:choosestringNo None py:contentstringNo None py:defstringNo None py:forstringNo None py:ifstringNo None py:matchstringNo None py:otherwiseTheotherwisedirective is used insidepy:chooseTypeorchooseto handle all conditions not handled by apy:when.stringNo None py:replacestringNo None py:stripstringNo None py:whenstringNo None py:withstringNo None
