XSLT section
============

A XSLT pipeline section lets you apply stylesheet to some XML data stored on
item. The XSLT section blueprint name is ``quintagroup.transmogrifier.xslt``.

That data need to be transformed is determined by ``source`` option. It gives
the key in dictionay where data is stored. Dictionary is standard structure
for storing files data in other our sections. Data is stored in item on ``_files``
key, but this can be changed with ``files-key`` option.

Usually stylesheets are used to transform data returned by ``marshall`` section.
We register those stylesheets in ZCML with special directive, for example:

::

    <stylesheet xmlns="http://namespaces.zope.org/transmogrifier"
        from="OldPortalType"
        to="NewPortalType"
        source="marshall"
        file="path/to/stylesheet.xsl"
        />

``source`` attribute in this directive is similar to that in section option.
The default value for this option is ``marshall``.

Which stylesheet to use is determined for every pipeline item by inspecting
it's values stored on keys specified in ``from-key`` and ``to-key`` section
options. These options are similar to ``from`` and ``to`` attributes in 
ZCML directive. If item hasn't those keys, it will be skipped.

>>> import tempfile
>>> tmp = tempfile.NamedTemporaryFile('w+', suffix='.xsl')
>>> tmp.flush()

We register only the 'Blog' to 'Weblog' conversion while 'Large Plone Folder' 
to 'Folder' relies on the fallback branch.

>>> stylesheet_registry.registerStylesheet('marshall', 'Blog', 'Weblog', tmp.name)
>>> xslt = """
... [transmogrifier]
... pipeline =
...     xsltsource
...     xslt
...     printer
... 
... [xsltsource]
... blueprint = quintagroup.transmogrifier.tests.xsltsource
... 
... [xslt]
... blueprint = quintagroup.transmogrifier.xslt
... source = marshall
... from-key = _old_type
... to-key = _type
... 
... [printer]
... blueprint = collective.transmogrifier.sections.tests.pprinter
... """
>>> registerConfig(u'quintagroup.transmogrifier.tests.xslt', xslt)
>>> transmogrifier(u'quintagroup.transmogrifier.tests.xslt') # doctest: +ELLIPSIS, +REPORT_NDIFF, +NORMALIZE_WHITESPACE
[]
[('_type', 'Weblog')]
[('_old_type', 'Blog')]
[('_files', [('manifest', [('data', 'xml'), ('name', 'manifest.xml')])]),
 ('_old_type', 'Blog'),
 ('_type', 'Weblog')]
[('_files',
  [('marshall', [('data', 'transformed xml'), ('name', 'marshall.xml')])]),
 ('_old_type', 'Blog'),
 ('_type', 'Weblog')]
[('_files',
  [('marshall', [('data', 'transformed xml'), ('name', 'marshall.xml')])]),
 ('_old_type', 'Large Plone Folder'),
 ('_type', 'Folder')]
