<?xml version="1.0"?>
<smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd"
                      xmlns:jb="http://www.milyn.org/xsd/smooks/javabean-1.2.xsd"
                      xmlns:ftl="http://www.milyn.org/xsd/smooks/freemarker-1.1.xsd">
    <!--
    This configuration binds data from the message into the Shipping object model,
    and then uses that binding data in a FreeMarker template to generate the result...
    -->

    <!--
    Configure the History bean creation and population. Wires in the "warehouse" bean.
    -->
    <jb:bean beanId="history" class="example.model.ShippingHistory" createOnElement="history">
        <jb:wiring property="warehouse" beanIdRef="warehouse"/>
        <!-- Note the date decoder is not configured with a format.  Will therefore use the default (SOAP).  See DateDecoder class. -->
        <jb:value property="creationDate" decoder="Date" data="header/date" />
        <!-- Note the "special" decoder for the trackingNumbers. -->
        <jb:value property="trackingNumbers" decoder="example.model.TrackingNumberDecoder" data="history/trackingNumbers" />
    </jb:bean>

    <!--
    Configure the Warehouse bean creation and population.
    Note how we create it on visiting the history. Is wired into the "history" bean.
    -->
    <jb:bean beanId="warehouse" class="example.model.Warehouse" createOnElement="history">
        <jb:value property="id" decoder="Integer" data="history/@warehouse" />
        <!-- Note the "special" decoder for mapping the warehouse id. -->
        <jb:value property="name" decoder="Mapping" data="history/@warehouse">
            <jb:decodeParam name="1">Dublin</jb:decodeParam>
            <jb:decodeParam name="2">Belfast</jb:decodeParam>
            <jb:decodeParam name="3">Cork</jb:decodeParam>
        </jb:value>
    </jb:bean>

    <!--
    Use a FreeMarker template to perform the model driven transformation.  You can also inline the template here.
    -->
    <ftl:freemarker applyOnElement="#document">
        <ftl:template>/example/templates/HistoryTrans.ftl</ftl:template>
    </ftl:freemarker>

</smooks-resource-list>
