apache > cocoon

- Home

# Pattern Transformer

The pattern transformer recognizes special texts part using patterns, and replaces them with XML elements. This transformer use a lexicon file to specify the pattern.

- Name: pattern
- Class: org.apache.cocoon.transformation.PatternTransformer
- Cacheable: yes - uses the last modification date of the lexicon document for validation.

The pattern transformer parses all text elements from the SAX stream, and replaces the special text parts.

    <myelement>
     bla blah Hello World bla
    </myelement>

The pattern transformer will replace these special text parts with a lexeme (token).

    <myelement>
     bla blah <lexeme xmlns="http://chaperon.sourceforge.net/schema/lexemes/1.0"
                      symbol="Hello World"
                      text="Hello World"/> bla
    </myelement>

A detailed explanation of function and the lexicon format can be found at Chaperon.

Errors and Improvements? If you see any errors or potential improvements in this document please help us: View, Edit or comment on the latest development version (registration required).