Pattern Transformer (2.1 legacy document)
Warning
This document was copied as is from the Cocoon 2.1 documentation, but has not
yet been fully reviewed or moved to its new 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.