Package genshi :: Package template :: Module directives :: Class MatchDirective

Class MatchDirective



object --+    
         |    
 Directive --+
             |
            MatchDirective

Implementation of the py:match template directive.

>>> from genshi.template import MarkupTemplate
>>> tmpl = MarkupTemplate('''<div xmlns:py="http://genshi.edgewall.org/">
...   <span py:match="greeting">
...     Hello ${select('@name')}
...   </span>
...   <greeting name="Dude" />
... </div>''')
>>> print tmpl.generate()
<div>
  <span>
    Hello Dude
  </span>
</div>


Nested Classes

Inherited from Directive: __metaclass__

Instance Methods
 
__init__(self, value, template, namespaces=None, lineno=-1, offset=-1)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
 
__call__(self, stream, ctxt, directives)
Apply the directive to the given stream.
 
__repr__(self)
repr(x)

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __str__

Class Methods

Inherited from Directive: attach

Class Variables
  ATTRIBUTE = 'path'
  tagname = 'match'
Properties
  namespaces
  path

Inherited from Directive: expr

Inherited from object: __class__

Method Details

__init__(self, value, template, namespaces=None, lineno=-1, offset=-1)
(Constructor)

 
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
Overrides: Directive.__init__

__call__(self, stream, ctxt, directives)
(Call operator)

 
Apply the directive to the given stream.
Overrides: Directive.__call__
(inherited documentation)

__repr__(self)
(Representation operator)

 
repr(x)
Overrides: Directive.__repr__