sampledoc

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

Any arbitrary child elements allowed

Text content:
Any

element py:replace

Attributes:
Name Description Values Required Default
py:value
The value to replace the contents with.
string Yes None

Any arbitrary child elements allowed

Text content:
Any

element py:choose

Attributes:
Name Description Values Required Default
py:test
If test is set, the child py: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 inside py:chooseType or choose to handle a single specific condition.

    Attributes:

    Name

    Description

    Values

    Required

    Default

    py:test

    The statement giving the value to test

    string

    Yes

    None

    Any arbitrary child elements allowed

    Text content:

    Any

  • element py:otherwise

    Any arbitrary child elements allowed

    Text content:

    Any

Text content:
Any

element py:for

Attributes:
Name Description Values Required Default
py:each
The loop iterator
string Yes None

Any arbitrary child elements allowed

Text content:
Any

element py:if

Attributes:
Name Description Values Required Default
py:test
The statement giving the value to test
string Yes None

Any arbitrary child elements allowed

Text content:
Any

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 the select() 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

Any arbitrary child elements allowed

Text content:
Any

element py:def

Attributes:
Name Description Values Required Default
py:function
The function prototype
string Yes None

Any arbitrary child elements allowed

Text content:
Any

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
The otherwise directive is used inside py:chooseType or choose to handle all conditions not handled by a py:when.
string No None
py:replace
string No None
py:strip
string No None
py:when
The when directive is used inside py:chooseType or choose to handle a single specific condition.
string No None
py:with
string No None

Table Of Contents

Previous topic

Bcfg2 Data Encryption

Next topic

The Bcfg2 Client

This Page