Edgewall Software

Changes between Version 19 and Version 20 of MarkupTemplates


Ignore:
Timestamp:
Jul 11, 2006, 9:48:05 PM (18 years ago)
Author:
cmlenz
Comment:

Basic info about py:match

Legend:

Unmodified
Added
Removed
Modified
  • MarkupTemplates

    v19 v20  
    277277=== `py:match` ===
    278278
     279This directive defines a ''match template'': given an XPath expression, it replaces any element in the template that matches the expression with its own content.
     280
     281For example, the match template defined in the following template matches any element with the tag name “greeting”:
     282
     283{{{
     284#!xml
     285<div xmlns:py="http://markup.edgewall.org/">
     286  <span py:match="greeting">
     287    Hello ${select('@name')}
     288  </span>
     289  <greeting name="Dude" />
     290</div>
     291}}}
     292
     293This would result in the following output:
     294
     295{{{
     296#!xml
     297<div>
     298  <span>
     299    Hello Dude
     300  </span>
     301</div>
     302}}}
     303
     304This directive can also be used as an element:
     305
     306{{{
     307#!xml
     308<div xmlns:py="http://markup.edgewall.org/">
     309  <py:match path="greeting">
     310    <span>Hello ${select('@name')}</span>
     311  </py:match>
     312  <greeting name="Dude" />
     313</div>
     314}}}
     315
    279316== Template Includes ==
    280317