NAME

Petal::Canonicalizer::XHTML - Builds an XHTML canonical Petal file

DESCRIPTION

This modules mainly implements the XML::Parser 'Stream' interface. It receives XML events and builds Petal canonical data, i.e.

<foo petal:if="bar">Hello</foo>

Might be canonicalized to something like

<?petal:if name="bar"?>
  <foo>Hello</foo>
<?petal:end?>

On top of that, Petal::Canonicalizer::XHTML will self close certain XHTML specific tags, like <br /> or <input ... />

StartTag

Called for every start tag with a second parameter of the element type. It will check for special PETAL attributes like petal:if, petal:loop, etc... and rewrite the start tag into @Petal::Canonicalizer::XML::Result accordingly.

For example

<foo petal:if="blah">

Is rewritten

<?petal:if name="blah"?><foo>...

EndTag

Called for every end tag with a second parameter of the element type. It will check in the @Petal::Canonicalizer::XML::NodeStack to see if this end-tag also needs to close some 'condition' or 'repeat' statements, i.e.

</li>

Could be rewritten

</li><?petal:end?>

If the starting LI used a loop, i.e. <li petal:loop="element list">