XSLT - Split the tag into group of 2 tags - xslt-2.0

I'm trying to perform an XSL transformation on the XML below:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns2:CommissionEvents xmlns="urn:tracelink:mapper:sl:canonical:commontypes" xmlns:ns2="urn:tracelink:mapper:sl:canonical:serialized_operations_manager">
<ns2:CommissionEvent>
<NumberList>
<Serial barcodeContent="(01)00355135132011(21)897883089643(17)230430(10)TLSMKTST" companyPrefix="0355135" filterValue="0" format="AI(01)+AI(21)">010035513513201121897883089643</Serial>
</NumberList>
</ns2:CommissionEvent>
<ns2:CommissionEvent>
<NumberList>
<Serial barcodeContent="(01)00355135132011(21)903131477120(17)230430(10)TLSMKTST" companyPrefix="0355135" filterValue="0" format="AI(01)+AI(21)">010035513513201121903131477120</Serial>
</NumberList>
</ns2:CommissionEvent>
<ns2:CommissionEvent>
<NumberList>
<Serial barcodeContent="(01)00355135132011(21)189513222896(17)230430(10)TLSMKTST" companyPrefix="0355135" filterValue="0" format="AI(01)+AI(21)">010035513513201121189513222896</Serial>
</NumberList>
</ns2:CommissionEvent>
<ns2:CommissionEvent>
<NumberList>
<Serial barcodeContent="(01)00355135132011(21)468091235492(17)230430(10)TLSMKTST" companyPrefix="0355135" filterValue="0" format="AI(01)+AI(21)">010035513513201121468091235492</Serial>
</NumberList>
</ns2:CommissionEvent>
<ns2:CommissionEvent>
<NumberList>
<Serial barcodeContent="(01)00355135132011(21)704297270475(17)230430(10)TLSMKTST" companyPrefix="0355135" filterValue="0" format="AI(01)+AI(21)">010035513513201121704297270475</Serial>
</NumberList>
</ns2:CommissionEvent>
<ns2:CommissionEvent>
<NumberList>
<Serial barcodeContent="(01)30355135132012(21)389170110454(17)230430(10)TLSMKTST" companyPrefix="0355135" filterValue="3" format="AI(01)+AI(21)">013035513513201221389170110454</Serial>
</NumberList>
</ns2:CommissionEvent>
<ns2:CommissionEvent>
<NumberList>
<Serial barcodeContent="(01)30355135132012(21)724826376009(17)230430(10)TLSMKTST" companyPrefix="0355135" filterValue="3" format="AI(01)+AI(21)">013035513513201221724826376009</Serial>
</NumberList>
</ns2:CommissionEvent>
<ns2:CommissionEvent>
<NumberList>
<Serial barcodeContent="(00)003551350000000907" companyPrefix="0355135" filterValue="0" format="AI(00)">00003551350000000907</Serial>
</NumberList>
</ns2:CommissionEvent>
<ns2:CommissionEvent>
<NumberList>
<Serial barcodeContent="(00)003551350000000235" companyPrefix="0355135" filterValue="0" format="AI(00)">00003551350000000235</Serial>
</NumberList>
</ns2:CommissionEvent>
</ns2:CommissionEvents>
Below is the attempt I made but did not get expected output--
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ns2="urn:tracelink:mapper:sl:canonical:serialized_operations_manager"
xpath-default-namespace="urn:tracelink:mapper:sl:canonical:commontypes"
xmlns:ns0="urn:tracelink:mapper:sl:canonical:commontypes">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="/ns2:CommissionEvents">
<xsl:copy>
<xsl:for-each-group select="ns2:CommissionEvent" group-by="NumberList/Serial/concat(#filterValue, '|', #format)">
<ns2:CommissionEvent>
<ns0:NumberList>
<xsl:for-each select="current-group()">
<ns0:Serial>
<xsl:copy-of select="NumberList/Serial/(#*|text())"/>
</ns0:Serial>
</xsl:for-each>
</ns0:NumberList>
</ns2:CommissionEvent>
</xsl:for-each-group>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
Output from above xslt --
<ns2:CommissionEvents>
<ns2:CommissionEvent>
<ns0:NumberList>
<ns0:Serial barcodeContent="(01)00355135132011(21)897883089643(17)230430(10)TLSMKTST" companyPrefix="0355135" filterValue="0" format="AI(01)+AI(21)" />
<ns0:Serial barcodeContent="(01)00355135132011(21)903131477120(17)230430(10)TLSMKTST" companyPrefix="0355135" filterValue="0" format="AI(01)+AI(21)" />
<ns0:Serial barcodeContent="(01)00355135132011(21)189513222896(17)230430(10)TLSMKTST" companyPrefix="0355135" filterValue="0" format="AI(01)+AI(21)" />
<ns0:Serial barcodeContent="(01)00355135132011(21)468091235492(17)230430(10)TLSMKTST" companyPrefix="0355135" filterValue="0" format="AI(01)+AI(21)" />
<ns0:Serial barcodeContent="(01)00355135132011(21)704297270475(17)230430(10)TLSMKTST" companyPrefix="0355135" filterValue="0" format="AI(01)+AI(21)" />
</ns0:NumberList>
</ns2:CommissionEvent>
<ns2:CommissionEvent>
<ns0:NumberList>
<ns0:Serial barcodeContent="(01)30355135132012(21)389170110454(17)230430(10)TLSMKTST" companyPrefix="0355135" filterValue="3" format="AI(01)+AI(21)" />
<ns0:Serial barcodeContent="(01)30355135132012(21)724826376009(17)230430(10)TLSMKTST" companyPrefix="0355135" filterValue="3" format="AI(01)+AI(21)" />
</ns0:NumberList>
</ns2:CommissionEvent>
<ns2:CommissionEvent>
<ns0:NumberList>
<ns0:Serial barcodeContent="(00)003551350000000907" companyPrefix="0355135" filterValue="0" format="AI(00)" />
<ns0:Serial barcodeContent="(00)003551350000000235" companyPrefix="0355135" filterValue="0" format="AI(00)" />
</ns0:NumberList>
</ns2:CommissionEvent>
</ns2:CommissionEvents>
The output I'm trying to achieve is something like the below. I tried for each loop grouping based on #filterValue and #format. Could someone help me achieving this using xslt 2.0
<ns2:CommissionEvents>
<ns2:CommissionEvent>
<ns0:NumberList>
<ns0:Serial barcodeContent="(01)00355135132011(21)897883089643(17)230430(10)TLSMKTST" companyPrefix="0355135" filterValue="0" format="AI(01)+AI(21)" />
<ns0:Serial barcodeContent="(01)00355135132011(21)903131477120(17)230430(10)TLSMKTST" companyPrefix="0355135" filterValue="0" format="AI(01)+AI(21)" />
</ns0:NumberList>
</ns2:CommissionEvent>
<ns2:CommissionEvent>
<ns0:NumberList>
<ns0:Serial barcodeContent="(01)00355135132011(21)189513222896(17)230430(10)TLSMKTST" companyPrefix="0355135" filterValue="0" format="AI(01)+AI(21)" />
<ns0:Serial barcodeContent="(01)00355135132011(21)468091235492(17)230430(10)TLSMKTST" companyPrefix="0355135" filterValue="0" format="AI(01)+AI(21)" />
<ns0:Serial barcodeContent="(01)00355135132011(21)704297270475(17)230430(10)TLSMKTST" companyPrefix="0355135" filterValue="0" format="AI(01)+AI(21)" />
</ns0:NumberList>
</ns2:CommissionEvent>
<ns2:CommissionEvent>
<ns0:NumberList>
<ns0:Serial barcodeContent="(01)30355135132012(21)389170110454(17)230430(10)TLSMKTST" companyPrefix="0355135" filterValue="3" format="AI(01)+AI(21)" />
<ns0:Serial barcodeContent="(01)30355135132012(21)724826376009(17)230430(10)TLSMKTST" companyPrefix="0355135" filterValue="3" format="AI(01)+AI(21)" />
</ns0:NumberList>
</ns2:CommissionEvent>
<ns2:CommissionEvent>
<ns0:NumberList>
<ns0:Serial barcodeContent="(00)003551350000000907" companyPrefix="0355135" filterValue="0" format="AI(00)" />
<ns0:Serial barcodeContent="(00)003551350000000235" companyPrefix="0355135" filterValue="0" format="AI(00)" />
</ns0:NumberList>
</ns2:CommissionEvent>
</ns2:CommissionEvents>

Related

convert flat XML to nested using for-each-group

I have to admit to failing miserably to understand how to use for-each-group. I've tried group-by, group-adjacent and I get arbitrary results that defy my understanding of what I've done wrong.
I have the following input XML which is 'flat': all the elements inside are siblings and I need to transform it to create a nested structure.
<document>
<separator style="XXX"/>
<paragraph style="aaa">
<p>text1</p>
</paragraph>
<paragraph style="bbb">
<p>text2</p>
</paragraph>
<paragraph style="list1">
<p>text3</p>
</paragraph>
<paragraph style="list1">
<p>text4</p>
</paragraph>
<paragraph style="list1">
<p>text5</p>
</paragraph>
<paragraph style="ccc">
<p>text6</p>
</paragraph>
<separator style="YYY"/>
<paragraph style="ddd">
<p>text7</p>
</paragraph>
<paragraph style="ddd">
<p>text8</p>
</paragraph>
<paragraph style="ddd">
<p>text9</p>
</paragraph>
<paragraph style="list1">
<p>text10</p>
</paragraph>
<paragraph style="list1">
<p>text11</p>
</paragraph>
<paragraph style="ddd">
<p>text12</p>
</paragraph>
I need the following output:
<document>
<separator style="XXX">
<paragraph style="aaa">
<p>text1</p>
</paragraph>
<paragraph style="bbb">
<p>text2</p>
</paragraph>
<list>
<paragraph style="list1">
<p>text3</p>
</paragraph>
<paragraph style="list1">
<p>text4</p>
</paragraph>
<paragraph style="list1">
<p>text5</p>
</paragraph>
</list>
<paragraph style="ccc">
<p>text6</p>
</paragraph>
</separator>
<separator style="YYY">
<paragraph style="ddd">
<p>text7</p>
</paragraph>
<paragraph style="ddd">
<p>text8</p>
</paragraph>
<paragraph style="ddd">
<p>text9</p>
</paragraph>
<list>
<paragraph style="list1">
<p>text10</p>
</paragraph>
<paragraph style="list1">
<p>text11</p>
</paragraph>
</list>
</separator>
I've not included any XSL that I've already tried as it is obviously incorrect!
The rules are not spelled out by a single sample but check whether the XSLT sample helps (tail is XPath/XSLT 3, use subsequence(current-group(), 2) if you really are stuck with XSLT 2):
<xsl:template match="document">
<xsl:copy>
<xsl:for-each-group select="*" group-starting-with="separator">
<xsl:copy>
<xsl:apply-templates select="#*"/>
<xsl:for-each-group select="tail(current-group())" group-adjacent="#style">
<xsl:choose>
<xsl:when test="starts-with(current-grouping-key(), 'list')">
<list>
<xsl:apply-templates select="current-group()"/>
</list>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="current-group()"/>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each-group>
</xsl:copy>
</xsl:for-each-group>
</xsl:copy>
</xsl:template>

SAPUI5 PlanningCalendar - binding two entities

I have the following problem:
I'm developing an APP using the flameworks PlanningCalendar, but I have two EntitySet:
Salas(3):
CAPACIDADE: 6
ID: 3
NOME: "SALA 3"
NavReservas: {__deferred: {…}}
__metadata: {type: "room_sfsf.rooms.SalasType", uri: "https://leandrp822648trial.hanatrial.ondemand.com:443/room_sfsf/rooms.xsodata/Salas(3)"}
__proto__: Object
__proto__: Object
and:
Reservas(1):
DATA_FIM: Tue Sep 18 2018 14:00:00 GMT-0300 (Horário Padrão de Brasília) {}
DATA_INICIO: Tue Sep 18 2018 12:00:00 GMT-0300 (Horário Padrão de Brasília) {}
ID: 1
ID_SALA: 3
NOME: "caio"
USUARIO: "caio.amorim"
__metadata:
type: "room_sfsf.rooms.ReservasType"
uri: "https://leandrp822648trial.hanatrial.ondemand.com:443/room_sfsf/rooms.xsodata/Reservas(1)
"
but I can not get the two to appear on the screen, but I can not get the two to appear on the related screen, Below is the view file:
<mvc:View
controllerName="br.com.successfactors.itz.MeetingRoomSuccessfactors.controller.Main"
xmlns:mvc="sap.ui.core.mvc"
xmlns:unified="sap.ui.unified"
xmlns="sap.m">
<VBox class="sapUiSmallMargin">
<PlanningCalendar
id="PC1"
startDate="{path: '/startDate'}"
rows="{path : '/Salas', parameters:{$expand: 'NavReservas'}}"
appointmentSelect="handleAppointmentSelect"
>
<toolbarContent>
<Title text="{i18n>title}" titleStyle="H4"/>
<ToolbarSpacer/>
<Button id="addButton" icon="sap-icon://add" press="handleAppointmentCreate" tooltip="Add"/>
</toolbarContent>
<rows>
<PlanningCalendarRow
id="PCR"
title="{NOME}"
text="{i18n>QuantRoom} {CAPACIDADE}"
appointments="{path: '/Reservas', templateShareable: 'true'}"
>
<!--intervalHeaders="{path: 'Employees', templateShareable: 'true'}">-->
<appointments >
<unified:CalendarAppointment
startDate="{DATA_INICIO}"
endDate="{DATA_FIM}"
icon="{}"
title="{NOME}"
text="{USER}"
type="{}"
tentative="{}"
>
</unified:CalendarAppointment>
</appointments>
<!-- <intervalHeaders>
<unified:CalendarAppointment
startDate="{start}"
endDate="{end}"
icon="{pic}"
title="{title}"
type="{type}">
</unified:CalendarAppointment>
</intervalHeaders>-->
</PlanningCalendarRow>
</rows>
</PlanningCalendar>
</VBox>
</mvc:View>
below the metadata file:
<edmx:Edmx xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx" Version="1.0">
<edmx:DataServices xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" m:DataServiceVersion="2.0">
<Schema xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"
xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns="http://schemas.microsoft.com/ado/2008/09/edm"
Namespace="room_sfsf.rooms">
<EntityType Name="SalasType">
<Key><PropertyRef Name="ID"/></Key><Property Name="ID" Type="Edm.Int32" Nullable="false"/><Property Name="NOME" Type="Edm.String" MaxLength="30"/><Property Name="CAPACIDADE" Type="Edm.Int32"/><NavigationProperty Name="NavReservas" Relationship="room_sfsf.rooms.Nav_ReservasType" FromRole="SalasPrincipal" ToRole="ReservasDependent"/></EntityType>
<EntityType Name="ReservasType">
<Key><PropertyRef Name="ID"/></Key><Property Name="ID" Type="Edm.Int32" Nullable="false"/><Property Name="NOME" Type="Edm.String" Nullable="false" MaxLength="30"/><Property Name="USUARIO" Type="Edm.String" MaxLength="20"/><Property Name="DATA_INICIO" Type="Edm.DateTime" Nullable="false"/><Property Name="DATA_FIM" Type="Edm.DateTime" Nullable="false"/><Property Name="ID_SALA" Type="Edm.Int32"/></EntityType>
<Association Name="Nav_ReservasType"><End Type="room_sfsf.rooms.SalasType" Role="SalasPrincipal" Multiplicity="1"/><End Type="room_sfsf.rooms.ReservasType" Role="ReservasDependent" Multiplicity="*"/>
<ReferentialConstraint>
<Principal Role="SalasPrincipal"><PropertyRef Name="ID"/></Principal>
<Dependent Role="ReservasDependent"><PropertyRef Name="ID_SALA"/></Dependent>
</ReferentialConstraint>
</Association>
<EntityContainer Name="rooms" m:IsDefaultEntityContainer="true"><EntitySet Name="Salas" EntityType="room_sfsf.rooms.SalasType"/><EntitySet Name="Reservas" EntityType="room_sfsf.rooms.ReservasType"/>
<AssociationSet Name="Nav_Reservas" Association="room_sfsf.rooms.Nav_ReservasType"><End Role="SalasPrincipal" EntitySet="Salas"/><End Role="ReservasDependent" EntitySet="Reservas"/></AssociationSet>
</EntityContainer>
</Schema>
</edmx:DataServices>
</edmx:Edmx>
image with the result on screen:
enter image description here
image the EntitySet:
enter image description here
Does anyone have any idea how I can solve this problem?
thank you so much.
ADD NEW COMMENT
I changed View after comment the Jorg, but not work, below:
<mvc:View
controllerName="br.com.successfactors.itz.MeetingRoomSuccessfactors.controller.Main"
xmlns:mvc="sap.ui.core.mvc"
xmlns:unified="sap.ui.unified"
xmlns="sap.m">
<VBox class="sapUiSmallMargin">
<PlanningCalendar
id="PC1"
startDate="{path: '/startDate'}"
rows="{path : '/Salas', parameters:{$expand: 'NavReservas'}}"
appointmentSelect="handleAppointmentSelect"
>
<toolbarContent>
<Title text="{i18n>title}" titleStyle="H4"/>
<ToolbarSpacer/>
<Button id="addButton" icon="sap-icon://add" press="handleAppointmentCreate" tooltip="Add"/>
</toolbarContent>
<rows>
<PlanningCalendarRow
id="PCR"
title="{NOME}"
text="{i18n>QuantRoom} {CAPACIDADE}"
appointments="{path: 'NavReservas', templateShareable: 'true'}"
>
<!--intervalHeaders="{path: 'Employees', templateShareable: 'true'}">-->
<appointments >
<unified:CalendarAppointment
startDate="{DATA_INICIO}"
endDate="{DATA_FIM}"
icon="{}"
title="{NOME}"
text="{USER}"
type="{}"
tentative="{}"
>
</unified:CalendarAppointment>
</appointments>
<!-- <intervalHeaders>
<unified:CalendarAppointment
startDate="{start}"
endDate="{end}"
icon="{pic}"
title="{title}"
type="{type}">
</unified:CalendarAppointment>
</intervalHeaders>-->
</PlanningCalendarRow>
</rows>
</PlanningCalendar>
</VBox>
</mvc:View>
Detail the error:
Uncaught Error: "[object Object]" is of type object, expected
sap.ui.core.URI for property "icon" of Element
sap.ui.unified.CalendarAppointment#__appointment0-__xmlview0--PCR-__xmlview0--PC1-0-0
at f.g.validateProperty (sap-ui-core.js:423)
at f.M.validateProperty (/resources/sap/ui/core/library-preload.js?eval:181)
at f.g.setProperty (sap-ui-core.js:421)
at f.setIcon (sap-ui-core.js:509)
at f.g.updateProperty (sap-ui-core.js:464)
at constructor.v (sap-ui-core.js:462)
at constructor.a.fireEvent (sap-ui-core.js:397)
at constructor.B._fireChange (sap-ui-core.js:1463)
at constructor.O.checkUpdate (/resources/sap/ui/core/library-preload.js?eval:2480)
at constructor.O.initialize (/resources/sap/ui/core/library-preload.js?eval:2475)
Image Result:
enter image description here
the browser it work!
{"d":{"results":[{"__metadata": {"type":"room_sfsf.rooms.ReservasType","uri":"https://leandrp822648trial.hanatrial.ondemand.com:443/room_sfsf/rooms.xsodata/Reservas(1)"},"ID":1,"NOME":"caio","USUARIO":"caio.amorim","DATA_INICIO":"\/Date(1537311600000)\/","DATA_FIM":"\/Date(1537318800000)\/","ID_SALA":3}]}}
enter image description here
Thanks.

Path to static image file modified to Orbeon resource protocol (oxf)

I'm using XInclude to import several forms as tabs on a multi-tabbed container form (using fr:tabbable and fr:tab). I am importing the model, binds, resources and body of each sub-form.
One of the components on a tab is an XBL component containing an HTML img element pointing to a static png image file. The image is displayed ok when the sub-form is published and invoked on its own, but when imported on to the multi-tabbed form the image link is broken.
When inspecting the source, the path to the image in the /xbl folder has been modified to include the oxf:/ protocol.
In addition, there is logic on the xbl form control to make it non-relevant when the form is loaded and depends on a checkbox to make it relevant. When the logic is removed, the image is displayed.
I have done some more testing and confirm that the problem occurs when enabling non-relevant controls on a form which has been imported via xinclude.
Orbeon is also in persistence mode using the CRUD REST api to save and publish forms as text files.
Is there anything I can do to make sure the image path is initialised when it is non-relevant?
Many thanks,
Import.xhtml
<xh:html xmlns:xh="http://www.w3.org/1999/xhtml" xmlns:xf="http://www.w3.org/2002/xforms"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ev="http://www.w3.org/2001/xml-events"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xxi="http://orbeon.org/oxf/xml/xinclude"
xmlns:xxf="http://orbeon.org/oxf/xml/xforms"
xmlns:exf="http://www.exforms.org/exf/1-0"
xmlns:fr="http://orbeon.org/oxf/xml/form-runner"
xmlns:saxon="http://saxon.sf.net/"
xmlns:sql="http://orbeon.org/oxf/xml/sql"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:fb="http://orbeon.org/oxf/xml/form-builder">
<xh:head>
<xh:title>Import Test</xh:title>
<xf:model id="fr-form-model" xxf:expose-xpath-types="true">
<!-- Main instance -->
<xf:instance id="fr-form-instance" xxf:exclude-result-prefixes="#all" xxf:index="id">
<form>
<xi:include href="oxf:/forms/Testing/FootMapTest/form/form.xhtml"
xpointer="xpath(//form/*)"/>
</form>
</xf:instance>
<!-- Bindings -->
<xf:bind id="fr-form-binds" ref="instance('fr-form-instance')">
<xi:include href="oxf:/forms/Testing/FootMapTest/form/form.xhtml"
xpointer="xpath(//xf:model/xf:bind[#id='fr-form-binds']/*)"/>
</xf:bind>
<!-- Metadata -->
<xf:instance xxf:readonly="true" id="fr-form-metadata" xxf:exclude-result-prefixes="#all">
<metadata>
<application-name>Testing</application-name>
<form-name>ImportTest</form-name>
<title xml:lang="en">Import Test</title>
<description xml:lang="en"/>
</metadata>
</xf:instance>
<!-- Attachments -->
<xf:instance id="fr-form-attachments" xxf:exclude-result-prefixes="#all">
<attachments>
<css mediatype="text/css" filename="" size=""/>
<pdf mediatype="application/pdf" filename="" size=""/>
</attachments>
</xf:instance>
<!-- All form resources -->
<xf:instance xxf:readonly="true" id="fr-form-resources" xxf:exclude-result-prefixes="#all">
<resources>
<resource xml:lang="en">
<xi:include href="oxf:/forms/Testing/FootMapTest/form/form.xhtml"
xpointer="xpath(//resources/resource[#xml:lang='en']/*)"/>
</resource>
</resources>
</xf:instance>
<!-- Utility instances for services -->
<xf:instance id="fr-service-request-instance" xxf:exclude-result-prefixes="#all">
<request/>
</xf:instance>
<xf:instance id="fr-service-response-instance" xxf:exclude-result-prefixes="#all">
<response/>
</xf:instance>
</xf:model>
</xh:head>
<xh:body>
<fr:view>
<fr:body xmlns:p="http://www.orbeon.com/oxf/pipeline"
xmlns:oxf="http://www.orbeon.com/oxf/processors"
xmlns:xbl="http://www.w3.org/ns/xbl">
<fr:tabbable>
<fr:tab>
<fr:label>Tab 1</fr:label>
<xi:include href="oxf:/forms/Testing/FootMapTest/form/form.xhtml"
xpointer="xpath(//xh:body/fr:view/fr:body/*)"/>
</fr:tab>
</fr:tabbable>
</fr:body>
</fr:view>
</xh:body>
</xh:html>
FootMapTest.xhtml
<xh:html xmlns:xh="http://www.w3.org/1999/xhtml" xmlns:xf="http://www.w3.org/2002/xforms"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ev="http://www.w3.org/2001/xml-events"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xxi="http://orbeon.org/oxf/xml/xinclude"
xmlns:xxf="http://orbeon.org/oxf/xml/xforms"
xmlns:exf="http://www.exforms.org/exf/1-0"
xmlns:fr="http://orbeon.org/oxf/xml/form-runner"
xmlns:saxon="http://saxon.sf.net/"
xmlns:sql="http://orbeon.org/oxf/xml/sql"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:fb="http://orbeon.org/oxf/xml/form-builder">
<xh:head>
<xh:title>FootMap Test</xh:title>
<xf:model id="fr-form-model" xxf:expose-xpath-types="true">
<!-- Main instance -->
<xf:instance id="fr-form-instance" xxf:exclude-result-prefixes="#all" xxf:index="id">
<form>
<section-1>
<showFoot/>
<control-2/>
</section-1>
</form>
</xf:instance>
<!-- Bindings -->
<xf:bind id="fr-form-binds" ref="instance('fr-form-instance')">
<xf:bind id="section-1-bind" name="section-1" ref="section-1">
<xf:bind id="control-2-bind" ref="control-2" name="control-2"
relevant="$showFoot=true()"/>
<xf:bind id="showFoot-bind" ref="showFoot" name="showFoot" type="xf:boolean"/>
</xf:bind>
</xf:bind>
<!-- Metadata -->
<xf:instance xxf:readonly="true" id="fr-form-metadata" xxf:exclude-result-prefixes="#all">
<metadata>
<application-name>Testing</application-name>
<form-name>FootMapTest</form-name>
<title xml:lang="en">FootMap Test</title>
<description xml:lang="en"/>
</metadata>
</xf:instance>
<!-- Attachments -->
<xf:instance id="fr-form-attachments" xxf:exclude-result-prefixes="#all">
<attachments>
<css mediatype="text/css" filename="" size=""/>
<pdf mediatype="application/pdf" filename="" size=""/>
</attachments>
</xf:instance>
<!-- All form resources -->
<xf:instance xxf:readonly="true" id="fr-form-resources" xxf:exclude-result-prefixes="#all">
<resources>
<resource xml:lang="en">
<showFoot>
<label>Show Foot?</label>
<hint/>
</showFoot>
<control-2>
<label/>
<hint/>
</control-2>
<section-1>
<label>Untitled Section</label>
</section-1>
</resource>
</resources>
</xf:instance>
<!-- Utility instances for services -->
<xf:instance id="fr-service-request-instance" xxf:exclude-result-prefixes="#all">
<request/>
</xf:instance>
<xf:instance id="fr-service-response-instance" xxf:exclude-result-prefixes="#all">
<response/>
</xf:instance>
</xf:model>
</xh:head>
<xh:body>
<fr:view>
<fr:body xmlns:p="http://www.orbeon.com/oxf/pipeline"
xmlns:oxf="http://www.orbeon.com/oxf/processors"
xmlns:xbl="http://www.w3.org/ns/xbl">
<fr:section id="section-1-control" bind="section-1-bind">
<xf:label ref="$form-resources/section-1/label"/>
<fr:grid>
<xh:tr>
<xh:td>
<fr:yesno-input xmlns="http://orbeon.org/oxf/xml/form-builder"
xmlns:xxbl="http://orbeon.org/oxf/xml/xbl"
id="showFoot-control"
bind="showFoot-bind">
<xf:label ref="$form-resources/showFoot/label"/>
<xf:hint ref="$form-resources/showFoot/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
</fr:yesno-input>
</xh:td>
<xh:td>
<nhs:footmap xmlns:nhs="http://www.wales.nhs.uk/"
xmlns="http://orbeon.org/oxf/xml/form-builder"
xmlns:xxbl="http://orbeon.org/oxf/xml/xbl"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
side="left"
siteselect=""
missingtoes=""
testorder=""
id="control-2-control"
bind="control-2-bind">
<xf:label ref="$form-resources/control-2/label"/>
<xf:hint ref="$form-resources/control-2/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
</nhs:footmap>
</xh:td>
</xh:tr>
</fr:grid>
</fr:section>
</fr:body>
</fr:view>
</xh:body>
</xh:html>
footmap.xbl
<xbl:xbl xmlns:xh="http://www.w3.org/1999/xhtml"
xmlns:xf="http://www.w3.org/2002/xforms"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:ev="http://www.w3.org/2001/xml-events"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xxi="http://orbeon.org/oxf/xml/xinclude"
xmlns:xxf="http://orbeon.org/oxf/xml/xforms"
xmlns:fr="http://orbeon.org/oxf/xml/form-runner"
xmlns:saxon="http://saxon.sf.net/"
xmlns:exf="http://www.exforms.org/exf/1-0"
xmlns:oxf="http://www.orbeon.com/oxf/processors"
xmlns:xbl="http://www.w3.org/ns/xbl"
xmlns:xxbl="http://orbeon.org/oxf/xml/xbl"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:nhs="http://www.wales.nhs.uk/">
<xbl:script src="/xbl/nhs/footmap/footmap.js"/>
<xbl:binding id="nhs-footmap" element="nhs|footmap"
xxf:external-events="nhs-footmap-updated nhs-footmap-refresh"
xxbl:mode="lhha binding value extenal-value focus"
xxbl:container="span">
<metadata xmlns="http://orbeon.org/oxf/xml/form-builder">
<display-name lang="en">Foot Map</display-name>
<icon lang="en">
<small-icon>/apps/fr/style/images/silk/image.png</small-icon>
<large-icon>/apps/fr/style/images/silk/image.png</large-icon>
</icon>
<templates>
<view>
<nhs:footmap side="left" siteselect="" missingtoes="" testorder="">
<xf:label ref=""/>
<xf:hint ref=""/>
<xf:help ref=""/>
<xf:alert ref=""/>
</nhs:footmap>
</view>
</templates>
<control-details>
<xf:select1 ref="#side">
<xf:label>Side:</xf:label>
<xf:hint>Which foot?</xf:hint>
<xf:item>
<xf:label>Left</xf:label>
<xf:value>left</xf:value>
</xf:item>
<xf:item>
<xf:label>Right</xf:label>
<xf:value>right</xf:value>
</xf:item>
</xf:select1>
<xf:select ref="#siteselect" appearance="full">
<xf:label>Sites:</xf:label>
<xf:hint>Which sites?</xf:hint>
<xf:item selected="true">
<xf:label>Big Toe (1):</xf:label>
<xf:value>1</xf:value>
</xf:item>
<xf:item selected="true">
<xf:label>Middle Toe (3):</xf:label>
<xf:value>3</xf:value>
</xf:item>
<xf:item selected="true">
<xf:label>Little Toe (5):</xf:label>
<xf:value>5</xf:value>
</xf:item>
<xf:item selected="false">
<xf:label>Plantar</xf:label>
<xf:value>6</xf:value>
</xf:item>
<xf:item selected="false">
<xf:label>Medial</xf:label>
<xf:value>7</xf:value>
</xf:item>
<xf:item selected="false">
<xf:label>Lateral</xf:label>
<xf:value>8</xf:value>
</xf:item>
</xf:select>
<xf:select ref="#missingtoes" appearance="full">
<xf:label>Missing Toes:</xf:label>
<xf:hint>Which toes are missing?</xf:hint>
<xf:item selected="false">
<xf:label>Big Toe (1):</xf:label>
<xf:value>1</xf:value>
</xf:item>
<xf:item selected="false">
<xf:label>Index Toe (2):</xf:label>
<xf:value>2</xf:value>
</xf:item>
<xf:item selected="false">
<xf:label>Middle Toe (3):</xf:label>
<xf:value>3</xf:value>
</xf:item>
<xf:item selected="false">
<xf:label>Fourth Toe (4):</xf:label>
<xf:value>4</xf:value>
</xf:item>
<xf:item selected="false">
<xf:label>Little Toe (5):</xf:label>
<xf:value>5</xf:value>
</xf:item>
</xf:select>
<xf:input ref="#testorder">
<xf:label>Test Order (json):</xf:label>
<xf:hint>What order should sites be tested?</xf:hint>
</xf:input>
</control-details>
</metadata>
<xbl:resources>
<xbl:style src="/xbl/nhs/footmap/footmap.css"/>
</xbl:resources>
<xbl:handlers>
<xbl:handler event="nhs-footmap-updated" phase="target">
<!-- <xf:message level="modal">
<xf:output value="event('states')" />
</xf:message> -->
<xf:var name="jsonstates" select="event('states')" />
<xf:setvalue ref="xxf:binding('nhs-footmap')" value="$jsonstates" />
</xbl:handler>
<xbl:handler type="javascript" ev:event="xforms-enabled" phase="target">
ORBEON.xforms.XBL.instanceForControl(this).updateAreas();
</xbl:handler>
<xbl:handler type="javascript" ev:event="xforms-disabled" phase="target">
//ORBEON.xforms.XBL.instanceForControl(this).hide();
</xbl:handler>
<!-- <xbl:handler type="javascript" event="nhs-footmap-refresh" phase="target">
ORBEON.xforms.XBL.instanceForControl(this).updateAreas();
</xbl:handler> -->
<xbl:handler type="javascript" event="xforms-value-changed" phase="target">
ORBEON.xforms.XBL.instanceForControl(this).updateAreas();
</xbl:handler>
</xbl:handlers>
<xbl:template xxbl:transform="oxf:unsafe-xslt">
<xsl:transform version="2.0">
<xsl:import href="oxf:/oxf/xslt/utils/xbl.xsl"/>
<xsl:template match="/*">
<xf:group class="nhs-footmap-container">
<xf:model id="footmap-model">
<xf:instance id="areastates">
<json type="object">
<data/>
</json>
</xf:instance>
<xf:instance id="local">
<model>
<side/>
<areas/>
</model>
</xf:instance>
</xf:model>
<!-- Variable pointing to external single-node binding -->
<xf:var name="binding" value="xxf:binding('nhs-footmap')"/>
<xf:var name="binding-context" value="xxf:binding-context('nhs-footmap')"/>
<xf:var name="local" value="instance('local')"/>
<xf:var name="view" value="exf:readonly($binding) and property('xxf:readonly-appearance') = 'static'"/>
<xsl:copy-of select="xxbl:parameter(., 'side')"/>
<xf:var name="leftFoot" value="$side = 'left'" />
<xf:var name="rightFoot" value="$side = 'right'" />
<xf:setvalue ref="instance('local')/side" value="{{$side}}" />
<xf:var name="requestPath" select="xxf:get-request-path()" />
<xsl:copy-of select="xxbl:parameter(., 'siteselect')"/>
<xf:var name="toe1" value="tokenize($siteselect, '\s+') = '1'" />
<xf:var name="toe3" value="tokenize($siteselect, '\s+') = '3'" />
<xf:var name="toe5" value="tokenize($siteselect, '\s+') = '5'" />
<xf:var name="plantar" value="tokenize($siteselect, '\s+') = '6'" />
<xf:var name="medial" value="tokenize($siteselect, '\s+') = '7'" />
<xf:var name="lateral" value="tokenize($siteselect, '\s+') = '8'" />
<xsl:copy-of select="xxbl:parameter(., 'missingtoes')"/>
<xf:var name="missing-toe1" value="tokenize($missingtoes, '\s+') = '1'" />
<xf:var name="missing-toe2" value="tokenize($missingtoes, '\s+') = '2'" />
<xf:var name="missing-toe3" value="tokenize($missingtoes, '\s+') = '3'" />
<xf:var name="missing-toe4" value="tokenize($missingtoes, '\s+') = '4'" />
<xf:var name="missing-toe5" value="tokenize($missingtoes, '\s+') = '5'" />
<xsl:copy-of select="xxbl:parameter(., 'testorder')"/>
<xf:var name="notestorder" value="string-length($testorder)=0" />
<!--<xf:group id="component-group" ref="$binding[not($view)]">-->
<xf:group id="component-group" ref="$binding">
<xf:input ref="$binding" id="nhs-footmap-states" class="nhs-footmap-states" />
<xh:div class="xbl-nhs-footmap-imagemap-div nhs-footmap-imgsize">
<xh:img class="nhs-footmap-footimage" src="/xbl/nhs/footmap/img/{{$side}}foot.png" usemap="#foot-imagemap-{{$side}}" />
<xf:group ref=".[$toe1 and not($missing-toe1)]">
<xh:a href="#" data-value="N" class="nhs-footmap-{{$side}}-toe1 nhs-footmap-site"> <xh:span class="badge">N</xh:span></xh:a>
</xf:group>
<xf:group ref=".[$missing-toe1]">
<xh:a href="#" data-value="-" class="nhs-footmap-{{$side}}-toe1 nhs-footmap-site toe-missing"> <xh:span class="badge"><xh:i class="icon-minus icon-white"/></xh:span></xh:a>
</xf:group>
<xf:group ref=".[$toe3 and not($missing-toe3)]">
<xh:a href="#" data-value="N" class="nhs-footmap-{{$side}}-toe3 nhs-footmap-site"> <xh:span class="badge">N</xh:span> </xh:a>
</xf:group>
<xf:group ref=".[$missing-toe3]">
<xh:a href="#" data-value="-" class="nhs-footmap-{{$side}}-toe3 nhs-footmap-site toe-missing"> <xh:span class="badge"><xh:i class="icon-minus icon-white"/></xh:span></xh:a>
</xf:group>
<xf:group ref=".[$toe5 and not($missing-toe5)]">
<xh:a href="#" data-value="N" class="nhs-footmap-{{$side}}-toe5 nhs-footmap-site"> <xh:span class="badge">N</xh:span> </xh:a>
</xf:group>
<xf:group ref=".[$missing-toe5]">
<xh:a href="#" data-value="-" class="nhs-footmap-{{$side}}-toe5 nhs-footmap-site toe-missing"> <xh:span class="badge"><xh:i class="icon-minus icon-white"/></xh:span></xh:a>
</xf:group>
<xf:group ref=".[$plantar]">
<xh:a href="#" data-value="N" class="nhs-footmap-{{$side}}-toe6 nhs-footmap-site"> <xh:span class="badge">N</xh:span> </xh:a>
</xf:group>
<xf:group ref=".[$medial]">
<xh:a href="#" data-value="N" class="nhs-footmap-{{$side}}-toe7 nhs-footmap-site"> <xh:span class="badge">N</xh:span> </xh:a>
</xf:group>
<xf:group ref=".[$lateral]">
<xh:a href="#" data-value="N" class="nhs-footmap-{{$side}}-toe8 nhs-footmap-site"> <xh:span class="badge">N</xh:span> </xh:a>
</xf:group>
<xf:group ref=".[not($notestorder)]">
<xh:span class="nhs-footmap-{{$side}}-testorder1 nhs-footmap-testorder badge" />
<xh:span class="nhs-footmap-{{$side}}-testorder3 nhs-footmap-testorder badge" />
<xh:span class="nhs-footmap-{{$side}}-testorder5 nhs-footmap-testorder badge" />
<xh:span class="nhs-footmap-{{$side}}-testorder6 nhs-footmap-testorder badge" />
<xh:span class="nhs-footmap-{{$side}}-testorder7 nhs-footmap-testorder badge" />
<xh:span class="nhs-footmap-{{$side}}-testorder8 nhs-footmap-testorder badge" />
</xf:group>
</xh:div>
<!--<xf:trigger id="resetButton">
<xf:label>Reset</xf:label>
<xf:action type="javascript" event="DOMActivate">
ORBEON.xforms.XBL.instanceForControl(this).reset();
</xf:action>
</xf:trigger>-->
<!--<xf:trigger id="absentButton">
<xf:label>Absent</xf:label>
<xf:action type="javascript" event="DOMActivate">
ORBEON.xforms.XBL.instanceForControl(this).absent();
</xf:action>
</xf:trigger>-->
<!-- Properties -->
</xf:group>
<!-- <xf:group ref="$binding[$view]"/> -->
</xf:group>
</xsl:template>
</xsl:transform>
</xbl:template>
</xbl:binding>
</xbl:xbl>

Problems with xsl:result-document and the creation of multiple files from a single source

I’m having issues attempting to get XSLT 2's result-document element to work properly. What I have in this case is an xml file with subscriber data in it and an xsl that is designed to transform it into a CSV.
I have a need in the solution to be able to specify several product codes and have the xsl transform the source document into multiple files one for each code in my selection.
Upon executing the following using the Saxon transform tool as follows:
C:\XSLTransformer\Transform.exe -xsl:"Example - Multifile Writer.xsl" -s:"Example.xml"
I get the files being created with names of Data Export Flatfile - P-PRPL.txt and Data Export Flatfile - P-YLW.txt. Both of the files contain the field headers, but neither file contains any actual data.
So, to reiterate the pdts: and csv: parts of the XSLT are being used correctly, as I’m able to render the files, but it seems that the supplied document is either being ignored, or the transform tool is having issues processing it in some way.
I know the XSLT in the file works, as I have a “manual” version of it that works without issue, but this one, where I hope to be able to automate some of the file production but giving it a bunch of codes to work on isn’t.
I suspect that the problem possibly lies with the transfer of the $code variable into the RenderRows template, but I can’t seem to put my finger on what exactly it is.
All help appreciated.
Thanks.
Example - Multifile Writer.xsl
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0" exclude-result-prefixes="#all" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:csv="csv:csv" xmlns:pdts="pdts:pdts">
<xsl:strip-space elements="*"/>
<xsl:output name="text" method="text" indent="no" omit-xml-declaration="yes" encoding="UTF-8"/>
<xsl:variable name="columnDelimiter" as="xs:string" select="' '"/>
<xsl:variable name="rowDelimiter" as="xs:string" select="'
'"/>
<!-- Modify this list to generate output for whatever other product codes you’re interested in -->
<!-- The solution will generate a new file for each product code. -->
<pdts:products>
<product Code="P-PURPLE" FileCode="P-PRPL"/>
<product Code="P-YELLOW" FileCode="P-YLW"/>
</pdts:products>
<!-- Output Columns -->
<csv:columns>
<column>Unique Reference Number</column>
<column>Contact (Donor)</column>
<column>Firstname</column>
<column>Surname</column>
<column>Company Name</column>
<column>Address 1</column>
<column>Address 2</column>
<column>City</column>
<column>PostCode</column>
<column>State</column>
<column>Country</column>
<column>Email</column>
<column>Mob Number</column>
<column>Tel Number</column>
<column>Product Offer</column>
<column>Start Date</column>
<column>End Date</column>
</csv:columns>
<xsl:variable name="path" as="xs:string" select="'C:\Temp\'"/>
<xsl:template match="/"> <!-- Match the root -->
<xsl:for-each select="document('')/*/pdts:products/*">
<xsl:variable name="filename" select="concat('file:///',$path,'Data Export Flatfile - ',#FileCode,'.txt')"/>
<xsl:variable name="code" select="#Code"/>
<xsl:result-document href="{$filename}" format="text">
<!-- Output the CSV headers -->
<xsl:call-template name="RenderColumnHeadings"/>
<!-- Output the individual rows -->
<xsl:call-template name="RenderRows">
<xsl:with-param name="prmPackage" select="/Subscribers/Organisations//Subscription[#PackageCode = $code]"/>
</xsl:call-template>
</xsl:result-document>
</xsl:for-each>
</xsl:template>
<xsl:template name="RenderColumnHeadings">
<xsl:for-each select="document('')/*/csv:columns/*">
<xsl:value-of select="."/>
<xsl:if test="position() != last()">
<xsl:value-of select="$columnDelimiter"/>
</xsl:if>
</xsl:for-each>
<xsl:value-of select="$rowDelimiter"/>
</xsl:template>
<xsl:template name="RenderRows">
<xsl:param name="prmPackage"/>
<xsl:for-each select="$prmPackage">
<!-- Variables: Life made simpler -->
<xsl:variable name="subscription" as="element(Subscription)" select="."/>
<xsl:variable name="subscriber" as="element(BusinessUnit)" select="$subscription/../../."/>
<xsl:variable name="organisation" as="element(Organisation)" select="$subscriber/../../."/>
<xsl:variable name="memberAddress" as="element(Address)" select="$subscriber//Address[#Type='Subscription']/."/>
<xsl:for-each select="$subscription//Recipient"><!-- Recipients -->
<xsl:variable name="publication" as="element(Publication)" select="./../../."/>
<xsl:value-of select="$subscription/#Id"/><!-- URN -->
<xsl:value-of select="$columnDelimiter"/>
<xsl:value-of select="concat($subscriber/Contact/#Forename,' ',$subscriber/Contact/#Surname)"/><!-- Contact (Donor) -->
<xsl:value-of select="$columnDelimiter"/>
<xsl:value-of select="substring-before(#ContactDisplayName,' ')"/><!-- Firstname -->
<xsl:value-of select="$columnDelimiter"/>
<xsl:value-of select="substring-after(#ContactDisplayName,' ')"/><!-- Surname -->
<xsl:value-of select="$columnDelimiter"/>
<xsl:value-of select="$organisation/#Name"/><!-- Company Name -->
<xsl:value-of select="$columnDelimiter"/>
<xsl:value-of select="Address/Line1"/><!-- Address 1 -->
<xsl:value-of select="$columnDelimiter"/>
<xsl:value-of select="Address/Line2"/><!-- Address 2 -->
<xsl:value-of select="$columnDelimiter"/>
<xsl:value-of select="Address/City"/><!-- City -->
<xsl:value-of select="$columnDelimiter"/>
<xsl:value-of select="Address/PostCode"/><!-- PostCode -->
<xsl:value-of select="$columnDelimiter"/>
<xsl:value-of select="Address/State"/><!-- State -->
<xsl:value-of select="$columnDelimiter"/>
<xsl:value-of select="Address/Country"/><!-- Country -->
<xsl:value-of select="$columnDelimiter"/>
<xsl:value-of select="#EmailAddress"/><!-- Email -->
<xsl:value-of select="$columnDelimiter"/>
<xsl:value-of select="#Cellular"/><!-- Mob Number -->
<xsl:value-of select="$columnDelimiter"/>
<xsl:value-of select="#Phone"/><!-- Tel Number -->
<xsl:value-of select="$columnDelimiter"/>
<xsl:value-of select="$subscription/#Name"/><!-- Product Offer -->
<xsl:value-of select="$columnDelimiter"/>
<xsl:value-of select="$subscription/#WhenStarts"/><!-- Start Date -->
<xsl:value-of select="$columnDelimiter"/>
<xsl:value-of select="$subscription/#WhenExpires"/><!-- End Date -->
<xsl:value-of select="$rowDelimiter"/>
</xsl:for-each>
</xsl:for-each>
</xsl:template>
Example Source Document
<Subscribers>
<Individuals>
<Individual Id="16493" Name="Alpha Zulu">
<Contact Id="16493" Forename="Alpha" Surname="Zulu" EmailAddress="alpha.zulu#alphabet.tld.dm" />
<Subscriptions>
<Subscription Id="181570" PackageCode="P-PURPLE" Name="Mike + Digital Edition" WhenCreated="2014-05-04T04:03:17.237" WhenStarts="2014-06-01T00:00:00" WhenExpires="2015-05-31T23:59:59.997" SubscriptionStatus="Current">
<GenericProducts />
<SecuredAccessProducts />
<Publications>
<Publication Id="148042" PublicationID="46" ProductCode="M-PURPLE" VersionNumber="1" Name="Mike Paid 1 Year" IssueCount="0" Quantity="1" ProductClassId="4">
<Recipients>
<Recipient Id="153364" ContactId="16493" ContactTypeId="1" ContactDisplayName="Alpha Zulu" Copies="1" WhenCreated="2014-05-04T04:03:17.247" EmailAddress="gZulu#alphabet.tld.dm" >
<Address>
<Line1>123 AAA ST</Line1>
<Line2></Line2>
<City>CCC</City>
<State>SSS</State>
<PostCode>9999</PostCode>
<Country>Australia</Country>
</Address>
</Recipient>
</Recipients>
</Publication>
<Publication Id="148043" PublicationID="114" ProductCode="M-RED" VersionNumber="1" Name="Delta Complimentary" IssueCount="0" Quantity="1" ProductClassId="34">
<Recipients>
<Recipient Id="153365" ContactId="16493" ContactTypeId="1" ContactDisplayName="Alpha Zulu" Copies="1" WhenCreated="2014-05-04T04:03:17.267" EmailAddress="gZulu#alphabet.tld.dm" >
<Address>
<Line1>123 AAA ST</Line1>
<Line2></Line2>
<City>CCC</City>
<State>SSS</State>
<PostCode>9999</PostCode>
<Country>Australia</Country>
</Address>
</Recipient>
</Recipients>
</Publication>
</Publications>
</Subscription>
</Subscriptions>
<Addresses>
<Address Type="Subscription">
<Line1>123 AAA ST</Line1>
<Line2></Line2>
<City>CCC</City>
<State>SSS</State>
<PostCode>9999</PostCode>
<Country>Australia</Country>
</Address>
</Addresses>
</Individual>
<Individual Id="23477" Name="Bravo Yankee">
<Contact Id="23477" Forename="Bravo" Surname="Yankee" EmailAddress="bravo.yankee#alphabet.tld.dm" />
<Subscriptions>
<Subscription Id="186018" PackageCode="P-YELLOW" Name="Mike Essential Package 10" WhenCreated="2014-07-04T08:50:04.767" WhenStarts="2014-07-04T00:00:00" WhenExpires="2015-07-03T23:59:59.997" SubscriptionStatus="Current">
<GenericProducts />
<SecuredAccessProducts>
<SecuredProduct Id="64886" SCAProductId="1" ProductCode="S-YELLOW" VersionNumber="1" MembershipTypeId="2" Name="Mike News.NET Standard 10" MaxMembers="10" LockedMemberCount="1" Quantity="1" ExternalName="Mike Standard 10" ProductClassId="1">
<Members>
<Member Id="16106772" Forename="Bravo" Surname="Yankee" EmailAddress="bravo.yankee#alphabet.tld.dm" />
</Members>
</SecuredProduct>
</SecuredAccessProducts>
<Publications>
<Publication Id="151954" PublicationID="46" ProductCode="M-PURPLE" VersionNumber="1" Name="Mike Paid 1 Year" IssueCount="12" Quantity="3" ExternalName="Monthly" ProductClassId="4">
<Recipients>
<Recipient Id="157514" ContactId="23477" ContactTypeId="1" ContactDisplayName="Bravo Yankee" Copies="1" WhenCreated="2014-07-04T08:50:05.493" EmailAddress="gYankee#alphabet.tld.dm" >
<Address>
<Line1>123 AAA ST</Line1>
<Line2></Line2>
<City>CCC</City>
<State>SSS</State>
<PostCode>9999</PostCode>
<Country>Australia</Country>
</Address>
</Recipient>
<Recipient Id="157515" ContactId="10226666" ContactTypeId="1" ContactDisplayName="Whiskey Zulu" Copies="2" WhenCreated="2014-07-04T08:50:05.787" EmailAddress="" >
<Address />
</Recipient>
</Recipients>
</Publication>
</Publications>
</Subscription>
</Subscriptions>
<Addresses>
<Address Type="Subscription">
<Line1>123 AAA ST</Line1>
<Line2></Line2>
<City>CCC</City>
<State>SSS</State>
<PostCode>9999</PostCode>
<Country>Australia</Country>
</Address>
</Addresses>
</Individual>
<Individual Id="73120" Name="Alpha Hotel">
<Contact Id="73120" Forename="Alpha" Surname="Hotel" EmailAddress="alpha.hotel#alphabet.tld.dm" />
<Subscriptions>
<Subscription Id="183293" PackageCode="P-PURPLE" Name="Mike + Digital Edition" WhenCreated="2014-06-03T04:03:40.483" WhenStarts="2014-07-01T00:00:00" WhenExpires="2015-06-30T23:59:59.997" SubscriptionStatus="Current">
<GenericProducts />
<SecuredAccessProducts />
<Publications>
<Publication Id="149560" PublicationID="46" ProductCode="M-PURPLE" VersionNumber="1" Name="Mike Paid 1 Year" IssueCount="0" Quantity="1" ProductClassId="4">
<Recipients>
<Recipient Id="155023" ContactId="73120" ContactTypeId="1" ContactDisplayName="Alpha Hotel" Copies="1" WhenCreated="2014-06-03T04:03:40.503" EmailAddress="Alpha.harvey#alphabet.tld.dm" >
<Address>
<Line1>123 AAA ST</Line1>
<Line2></Line2>
<City>CCC</City>
<State>SSS</State>
<PostCode>9999</PostCode>
<Country>Australia</Country>
</Address>
</Recipient>
</Recipients>
</Publication>
<Publication Id="149561" PublicationID="114" ProductCode="M-RED" VersionNumber="1" Name="Delta Complimentary" IssueCount="0" Quantity="1" ProductClassId="34">
<Recipients>
<Recipient Id="155024" ContactId="73120" ContactTypeId="1" ContactDisplayName="Alpha Hotel" Copies="1" WhenCreated="2014-06-03T04:03:40.543" EmailAddress="Alpha.harvey#alphabet.tld.dm" >
<Address>
<Line1>123 AAA ST</Line1>
<Line2></Line2>
<City>CCC</City>
<State>SSS</State>
<PostCode>9999</PostCode>
<Country>Australia</Country>
</Address>
</Recipient>
</Recipients>
</Publication>
</Publications>
</Subscription>
</Subscriptions>
<Addresses>
<Address Type="Subscription">
<Line1>123 AAA ST</Line1>
<Line2></Line2>
<City>CCC</City>
<State>SSS</State>
<PostCode>9999</PostCode>
<Country>Australia</Country>
</Address>
</Addresses>
</Individual>
</Individuals>
<Organisations>
<Organisation Id="13" Name="Alpha Limited">
<BusinessUnits>
<BusinessUnit Id="560" Name="Bravo WA, Australia" Facsimile="">
<Contact Id="1062276946" Forename="Kilo" Surname="Bravo" EmailAddress="kilo.bravo#alphabet.tld.dm" />
<Agency />
<Subscriptions>
<Subscription Id="168271" PackageCode="P-YELLOW" Name="Mike Essential Plus Package 25" WhenCreated="2014-01-24T04:03:02.103" WhenStarts="2014-02-21T00:00:00" WhenExpires="2015-02-20T23:59:59.997" SubscriptionStatus="Renewed">
<GenericProducts />
<SecuredAccessProducts>
<SecuredProduct Id="60181" SCAProductId="3" ProductCode="S-MNP1Y" VersionNumber="1" MembershipTypeId="3" Name="Mike News.NET Premium 25" MaxMembers="25" LockedMemberCount="1" Quantity="1" ExternalName="Mike Premium 25" ProductClassId="2">
<Members />
</SecuredProduct>
</SecuredAccessProducts>
<Publications>
<Publication Id="133606" PublicationID="46" ProductCode="M-PURPLE" VersionNumber="1" Name="Mike Paid 1 Year" IssueCount="0" Quantity="5" ProductClassId="4">
<Recipients>
<Recipient Id="138626" BusinessUnitId="560" ContactId="8342" ContactTypeId="2" ContactDisplayName="Indigo Charlie" Copies="1" WhenCreated="2014-01-24T04:03:02.410" EmailAddress="indigo.charlie#alphabet.tld.dm" >
<Address>
<Line1>123 AAA ST</Line1>
<Line2></Line2>
<City>CCC</City>
<State>SSS</State>
<PostCode>9999</PostCode>
<Country>Australia</Country>
</Address>
</Recipient>
<Recipient Id="138627" BusinessUnitId="4807005" ContactId="121315" ContactTypeId="2" ContactDisplayName="Mike Sierra" Copies="1" WhenCreated="2014-01-24T04:03:02.423" EmailAddress="mike.sierra#alphabet.tld.dm" >
<Address>
<Line1>123 AAA ST</Line1>
<Line2></Line2>
<City>CCC</City>
<State>SSS</State>
<PostCode>9999</PostCode>
<Country>Australia</Country>
</Address>
</Recipient>
<Recipient Id="138628" BusinessUnitId="3844766" ContactId="149273" ContactTypeId="2" ContactDisplayName="Papa Delta" Copies="1" WhenCreated="2014-01-24T04:03:02.437" EmailAddress="papa.delta#alphabet.tld.dm" >
<Address>
<Line1>123 AAA ST</Line1>
<Line2></Line2>
<City>CCC</City>
<State>SSS</State>
<PostCode>9999</PostCode>
<Country>Australia</Country>
</Address>
</Recipient>
<Recipient Id="138658" BusinessUnitId="4807007" ContactId="18761725" ContactTypeId="2" ContactDisplayName="Sierra Bravo" Copies="2" WhenCreated="2014-01-24T13:58:06.787" EmailAddress="sierra.bravo#alphabet.tld.dm" >
<Address>
<Line1>123 AAA ST</Line1>
<Line2></Line2>
<City>CCC</City>
<State>SSS</State>
<PostCode>9999</PostCode>
<Country>Australia</Country>
</Address>
</Recipient>
</Recipients>
</Publication>
</Publications>
</Subscription>
<Subscription Id="202338" PackageCode="P-YELLOW" Name="Mike Essential Plus Package 25" WhenCreated="2015-01-24T04:03:04.277" WhenStarts="2015-02-21T00:00:00" WhenExpires="2016-02-20T23:59:59.997" SubscriptionStatus="Current">
<GenericProducts />
<SecuredAccessProducts>
<SecuredProduct Id="71637" SCAProductId="3" ProductCode="S-MNP1Y" VersionNumber="1" MembershipTypeId="3" Name="Mike News.NET Premium 25" MaxMembers="25" LockedMemberCount="1" Quantity="1" ExternalName="Mike Premium 25" ProductClassId="2">
<Members>
<Member Id="5351" Forename="Indigo" Surname="Charlie" EmailAddress="indigo.charlie#alphabet.tld.dm" />
<Member Id="7755" Forename="Kilo" Surname="Bravo" EmailAddress="kilo.bravo#alphabet.tld.dm" />
<Member Id="7756" Forename="Lima" Surname="Charlie" EmailAddress="lima.charlie#alphabet.tld.dm" />
<Member Id="7758" Forename="Tango" Surname="Romeo" EmailAddress="tango.romeo#alphabet.tld.dm" />
<Member Id="104333" Forename="Mike" Surname="Sierra" EmailAddress="mike.sierra#alphabet.tld.dm" />
<Member Id="109664" Forename="Delta" Surname="Mike" EmailAddress="delta.mike#alphabet.tld.dm" />
<Member Id="128216" Forename="Papa" Surname="Delta" EmailAddress="papa.delta#alphabet.tld.dm" />
<Member Id="9599153" Forename="Sierra" Surname="Bravo" EmailAddress="sierra.bravo#alphabet.tld.dm" />
<Member Id="9644184" Forename="Mike" Surname="Bravo" EmailAddress="mike.bravo#alphabet.tld.dm" />
<Member Id="12953504" Forename="Sierra" Surname="Papa" EmailAddress="sierra.papa#alphabet.tld.dm" />
<Member Id="12953505" Forename="Kilo" Surname="Mike" EmailAddress="kilo.mike#alphabet.tld.dm" />
<Member Id="12953927" Forename="Alpha" Surname="Juliet" EmailAddress="alpha.juliet#alphabet.tld.dm" />
<Member Id="16059657" Forename="Kilo" Surname="Delta" EmailAddress="kilo.delta#alphabet.tld.dm" />
<Member Id="16061101" Forename="Bravo" Surname="Whiskey" EmailAddress="bravo.whiskey#alphabet.tld.dm" />
<Member Id="16061102" Forename="November" Surname="Echo" EmailAddress="november.echo#alphabet.tld.dm" />
<Member Id="16350124" Forename="Kilo" Surname="Papa" EmailAddress="kilo.papa#alphabet.tld.dm" />
<Member Id="16350125" Forename="November" Surname="Charlie" EmailAddress="november.charlie#alphabet.tld.dm" />
<Member Id="16372932" Forename="Hotel" Surname="Hotel" EmailAddress="hotel.hotel#alphabet.tld.dm" />
<Member Id="16372933" Forename="Sierra" Surname="Juliet" EmailAddress="sierra.juliet#alphabet.tld.dm" />
<Member Id="38777399" Forename="Sierra" Surname="Romeo" EmailAddress="sierra.romeo#alphabet.tld.dm" />
</Members>
</SecuredProduct>
</SecuredAccessProducts>
<Publications>
<Publication Id="166113" PublicationID="46" ProductCode="M-GREEN" VersionNumber="1" Name="Mike Paid 1 Year" IssueCount="0" Quantity="5" ProductClassId="4">
<Recipients>
<Recipient Id="172383" BusinessUnitId="560" ContactId="8342" ContactTypeId="2" ContactDisplayName="Indigo Charlie" Copies="1" WhenCreated="2015-01-24T04:03:04.287" EmailAddress="ichalmers#alphabet.tld.dm" >
<Address>
<Line1>123 AAA ST</Line1>
<Line2></Line2>
<City>CCC</City>
<State>SSS</State>
<PostCode>9999</PostCode>
<Country>Australia</Country>
</Address>
</Recipient>
<Recipient Id="172384" BusinessUnitId="4807005" ContactId="121315" ContactTypeId="2" ContactDisplayName="Mike Sierra" Copies="1" WhenCreated="2015-01-24T04:03:04.290" EmailAddress="mike.sierra#alphabet.tld.dm" >
<Address>
<Line1>123 AAA ST</Line1>
<Line2></Line2>
<City>CCC</City>
<State>SSS</State>
<PostCode>9999</PostCode>
<Country>Australia</Country>
</Address>
</Recipient>
<Recipient Id="172385" BusinessUnitId="3844766" ContactId="149273" ContactTypeId="2" ContactDisplayName="Papa Delta" Copies="1" WhenCreated="2015-01-24T04:03:04.297" EmailAddress="papa.delta#alphabet.tld.dm" >
<Address>
<Line1>123 AAA ST</Line1>
<Line2></Line2>
<City>CCC</City>
<State>SSS</State>
<PostCode>9999</PostCode>
<Country>Australia</Country>
</Address>
</Recipient>
<Recipient Id="172386" BusinessUnitId="4807007" ContactId="18761725" ContactTypeId="2" ContactDisplayName="Sierra Bravo" Copies="2" WhenCreated="2015-01-24T04:03:04.303" EmailAddress="sierra.bravo#alphabet.tld.dm" >
<Address>
<Line1>123 AAA ST</Line1>
<Line2></Line2>
<City>CCC</City>
<State>SSS</State>
<PostCode>9999</PostCode>
<Country>Australia</Country>
</Address>
</Recipient>
</Recipients>
</Publication>
</Publications>
</Subscription>
</Subscriptions>
<Addresses>
<Address Type="Subscription">
<Line1>123 AAA ST</Line1>
<Line2 />
<City>CCC</City>
<State>SSS</State>
<PostCode>9999</PostCode>
<Country>Australia</Country>
</Address>
<Address Type="Standard">
<Line1>123 AAA ST</Line1>
<Line2 />
<City>CCC</City>
<State>SSS</State>
<PostCode>9999</PostCode>
<Country>Australia</Country>
</Address>
<Address Type="Charlie Register">
<Line1>123 AAA ST</Line1>
<Line2 />
<City>CCC</City>
<State>SSS</State>
<PostCode>9999</PostCode>
<Country>Australia</Country>
</Address>
</Addresses>
</BusinessUnit>
</BusinessUnits>
</Organisation>
<Organisation Id="17" Name="Bravo Limited">
<BusinessUnits>
<BusinessUnit Id="546" Name="Echo PERTH, WA, Australia" MSDynamicsId="35352" Facsimile="61 8 6218 8880">
<Contact Id="1084704665" Forename="Hotel" Surname="Whiskey" EmailAddress="hotel.whiskey#alphabet.tld.dm" />
<Agency />
<Subscriptions>
<Subscription Id="176647" Name="Mike Paid 1 Year" WhenCreated="2014-04-14T10:14:43.287" WhenStarts="2014-06-21T00:00:00" WhenExpires="2015-06-20T23:59:59.997" SubscriptionStatus="Current">
<GenericProducts />
<SecuredAccessProducts />
<Publications>
<Publication Id="142935" PublicationID="46" ProductCode="M-GREEN" VersionNumber="1" Name="Mike Paid 1 Year" IssueCount="12" Quantity="10" ProductClassId="4">
<Recipients>
<Recipient Id="148228" BusinessUnitId="546" ContactId="1062276276" ContactTypeId="2" ContactDisplayName="Romeo Charlie" Copies="6" WhenCreated="2014-04-14T11:51:17.710" EmailAddress="romeo.charlie#alphabet.tld.dm" >
<Address>
<Line1>123 AAA ST</Line1>
<Line2></Line2>
<City>CCC</City>
<State>SSS</State>
<PostCode>9999</PostCode>
<Country>Australia</Country>
</Address>
</Recipient>
<Recipient Id="175024" BusinessUnitId="4807112" ContactId="10226666" ContactTypeId="2" ContactDisplayName="Whiskey Zulu" Copies="4" WhenCreated="2015-02-19T14:22:01.540" EmailAddress="" >
<Address />
</Recipient>
</Recipients>
</Publication>
</Publications>
</Subscription>
</Subscriptions>
<Addresses>
<Address Type="Subscription">
<Line1>123 AAA ST</Line1>
<Line2 />
<City>CCC</City>
<State>SSS</State>
<PostCode>9999</PostCode>
<Country>Australia</Country>
</Address>
<Address Type="Standard">
<Line1>123 AAA ST</Line1>
<Line2 />
<City>CCC</City>
<State>SSS</State>
<PostCode>9999</PostCode>
<Country>Australia</Country>
</Address>
<Address Type="Charlie Register">
<Line1>123 AAA ST</Line1>
<Line2 />
<City>CCC</City>
<State>SSS</State>
<PostCode>9999</PostCode>
<Country>Australia</Country>
</Address>
</Addresses>
</BusinessUnit>
</BusinessUnits>
</Organisation>
<Organisation Id="32" Name="Delta Limited">
<BusinessUnits>
<BusinessUnit Id="70579" Name="Mike VIC, Australia" Facsimile="">
<Contact Id="17874450" Forename="Kilo" Surname="Foxtrot" EmailAddress="kilo.foxtrot#alphabet.tld.dm" />
<Agency />
<Subscriptions>
<Subscription Id="173024" PackageCode="P-YELLOW" Name="Mike Essential Plus Package 25" WhenCreated="2014-03-19T04:04:28.137" WhenStarts="2014-04-16T00:00:00" WhenExpires="2015-04-15T23:59:59.997" SubscriptionStatus="Current">
<GenericProducts />
<SecuredAccessProducts>
<SecuredProduct Id="61926" SCAProductId="3" ProductCode="S-MNP1Y" VersionNumber="1" MembershipTypeId="3" Name="Mike News.NET Premium 25" MaxMembers="25" LockedMemberCount="1" Quantity="1" ExternalName="Mike Premium 25" ProductClassId="2">
<Members>
<Member Id="514" Forename="Romeo" Surname="Lima" EmailAddress="romeo.lima#alphabet.tld.dm" />
<Member Id="104734" Forename="Romeo" Surname="Mike" EmailAddress="romeo.mike#alphabet.tld.dm" />
<Member Id="1007933" Forename="Romeo" Surname="Bravo" EmailAddress="romeo.bravo#alphabet.tld.dm" />
<Member Id="1087600" Forename="Delta" Surname="Foxtrot" EmailAddress="delta.foxtrot#alphabet.tld.dm" />
<Member Id="2408219" Forename="Alpha" Surname="Lima" EmailAddress="alpha.lima#alphabet.tld.dm" />
<Member Id="9597365" Forename="Kilo" Surname="Foxtrot" EmailAddress="kilo.foxtrot#alphabet.tld.dm" />
<Member Id="9983336" Forename="Juliet" Surname="Delta" EmailAddress="juliet.delta#alphabet.tld.dm" />
<Member Id="9983338" Forename="Alpha" Surname="Charlie" EmailAddress="alpha.charlie#alphabet.tld.dm" />
<Member Id="12975663" Forename="Sierra" Surname="Juliet" EmailAddress="sierra.juliet#alphabet.tld.dm" />
<Member Id="16349491" Forename="Alpha" Surname="Mike" EmailAddress="alpha.mike#alphabet.tld.dm" />
</Members>
</SecuredProduct>
</SecuredAccessProducts>
<Publications>
<Publication Id="137472" PublicationID="46" ProductCode="M-GREEN" VersionNumber="1" Name="Mike Paid 1 Year" IssueCount="0" Quantity="5" ProductClassId="4">
<Recipients>
<Recipient Id="142694" BusinessUnitId="70579" ContactId="23270" ContactTypeId="2" ContactDisplayName="Bravo Hotel" Copies="5" WhenCreated="2014-03-19T04:04:28.240" EmailAddress="" >
<Address>
<Line1>123 AAA ST</Line1>
<Line2></Line2>
<City>CCC</City>
<State>SSS</State>
<PostCode>9999</PostCode>
<Country>Australia</Country>
</Address>
</Recipient>
</Recipients>
</Publication>
</Publications>
</Subscription>
</Subscriptions>
<Addresses>
<Address Type="Subscription">
<Line1>123 AAA ST</Line1>
<Line2 />
<City>CCC</City>
<State>SSS</State>
<PostCode>9999</PostCode>
<Country>Australia</Country>
</Address>
<Address Type="Standard">
<Line1>123 AAA ST</Line1>
<Line2 />
<City>CCC</City>
<State>SSS</State>
<PostCode>9999</PostCode>
<Country>Australia</Country>
</Address>
<Address Type="Charlie Register">
<Line1>123 AAA ST</Line1>
<Line2 />
<City>CCC</City>
<State>SSS</State>
<PostCode>9999</PostCode>
<Country>Australia</Country>
</Address>
</Addresses>
</BusinessUnit>
</BusinessUnits>
</Organisation>
</Organisations>
Change
<xsl:template match="/"> <!-- Match the root -->
<xsl:for-each select="document('')/*/pdts:products/*">
<xsl:variable name="filename" select="concat('file:///',$path,'Data Export Flatfile - ',#FileCode,'.txt')"/>
<xsl:variable name="code" select="#Code"/>
<xsl:result-document href="{$filename}" format="text">
<!-- Output the CSV headers -->
<xsl:call-template name="RenderColumnHeadings"/>
<!-- Output the individual rows -->
<xsl:call-template name="RenderRows">
<xsl:with-param name="prmPackage" select="/Subscribers/Organisations//Subscription[#PackageCode = $code]"/>
</xsl:call-template>
</xsl:result-document>
</xsl:for-each>
</xsl:template>
to
<xsl:template match="/"> <!-- Match the root -->
<xsl:variable name="root" select="."/>
<xsl:for-each select="document('')/*/pdts:products/*">
<xsl:variable name="filename" select="concat('file:///',$path,'Data Export Flatfile - ',#FileCode,'.txt')"/>
<xsl:variable name="code" select="#Code"/>
<xsl:result-document href="{$filename}" format="text">
<!-- Output the CSV headers -->
<xsl:call-template name="RenderColumnHeadings"/>
<!-- Output the individual rows -->
<xsl:call-template name="RenderRows">
<xsl:with-param name="prmPackage" select="$root/Subscribers/Organisations//Subscription[#PackageCode = $code]"/>
</xsl:call-template>
</xsl:result-document>
</xsl:for-each>
</xsl:template>

Child Window Template SilverLight 3

How to change the GUI of the child window in silverlight , how to apply template or style any good example reference will help.
thanks in advance
For addition information:
I would like to change the title bar shape, the close button shape and the body area shape as well, you can say I want to change the View of the childWidow control.
Here's the template as outputted from Blend.
<ControlTemplate x:Key="ChildWindowControlTemplate1" TargetType="controls:ChildWindow">
<Grid x:Name="Root">
<Grid.Resources>
<Style x:Key="ButtonStyle" TargetType="Button">
<Setter Property="Background" Value="#FF1F3B53"/>
<Setter Property="Foreground" Value="#FF000000"/>
<Setter Property="Padding" Value="3"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="BorderBrush">
<Setter.Value>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#FFA3AEB9" Offset="0"/>
<GradientStop Color="#FF8399A9" Offset="0.375"/>
<GradientStop Color="#FF718597" Offset="0.375"/>
<GradientStop Color="#FF617584" Offset="1"/>
</LinearGradientBrush>
</Setter.Value>
</Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Grid x:Name="grid" Background="#02FFFFFF" HorizontalAlignment="Center" Height="14" VerticalAlignment="Center" Width="15">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal"/>
<VisualState x:Name="MouseOver">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="X_Fuzz2">
<DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="X_Fuzz1">
<DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="X_Fuzz0">
<DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/>
</ObjectAnimationUsingKeyFrames>
<DoubleAnimation Duration="0" To="0.95" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="X"/>
</Storyboard>
</VisualState>
<VisualState x:Name="Pressed">
<Storyboard>
<DoubleAnimation Duration="0" To="0.85" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="X"/>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="X_Fuzz2">
<DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="X_Fuzz1">
<DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="X_Fuzz0">
<DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Disabled">
<Storyboard>
<DoubleAnimation Duration="0" To="0.5" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="X"/>
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Path x:Name="X_Fuzz2" Data="F1 M 6.742676,3.852539 L 9.110840,1.559570 L 8.910645,0.500000 L 6.838379,0.500000 L 4.902832,2.435547 L 2.967285,0.500000 L 0.895020,0.500000 L 0.694824,1.559570 L 3.062988,3.852539 L 0.527832,6.351563 L 0.689941,7.600586 L 2.967285,7.600586 L 4.897949,5.575195 L 6.854004,7.600586 L 9.115723,7.600586 L 9.277832,6.351563 L 6.742676,3.852539 Z" Fill="#14C51900" HorizontalAlignment="Center" Height="8" Margin="0,-1,0,0" Opacity="1" RenderTransformOrigin="0.5,0.5" Stretch="Fill" Stroke="#14C51900" Visibility="Collapsed" VerticalAlignment="Center" Width="9">
<Path.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleY="1.3" ScaleX="1.3"/>
</TransformGroup>
</Path.RenderTransform>
</Path>
<Path x:Name="X_Fuzz1" Data="F1 M 6.742676,3.852539 L 9.110840,1.559570 L 8.910645,0.500000 L 6.838379,0.500000 L 4.902832,2.435547 L 2.967285,0.500000 L 0.895020,0.500000 L 0.694824,1.559570 L 3.062988,3.852539 L 0.527832,6.351563 L 0.689941,7.600586 L 2.967285,7.600586 L 4.897949,5.575195 L 6.854004,7.600586 L 9.115723,7.600586 L 9.277832,6.351563 L 6.742676,3.852539 Z" Fill="#1EC51900" HorizontalAlignment="Center" Height="8" Margin="0,-1,0,0" Opacity="1" RenderTransformOrigin="0.5,0.5" Stretch="Fill" Stroke="#1EC51900" Visibility="Collapsed" VerticalAlignment="Center" Width="9">
<Path.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleY="1.1" ScaleX="1.1"/>
</TransformGroup>
</Path.RenderTransform>
</Path>
<Path x:Name="X_Fuzz0" Data="F1 M 6.742676,3.852539 L 9.110840,1.559570 L 8.910645,0.500000 L 6.838379,0.500000 L 4.902832,2.435547 L 2.967285,0.500000 L 0.895020,0.500000 L 0.694824,1.559570 L 3.062988,3.852539 L 0.527832,6.351563 L 0.689941,7.600586 L 2.967285,7.600586 L 4.897949,5.575195 L 6.854004,7.600586 L 9.115723,7.600586 L 9.277832,6.351563 L 6.742676,3.852539 Z" Fill="#FFC51900" HorizontalAlignment="Center" Height="8" Margin="0,-1,0,0" Opacity="1" Stretch="Fill" Stroke="#FFC51900" Visibility="Collapsed" VerticalAlignment="Center" Width="9"/>
<Path x:Name="X" Data="F1 M 6.742676,3.852539 L 9.110840,1.559570 L 8.910645,0.500000 L 6.838379,0.500000 L 4.902832,2.435547 L 2.967285,0.500000 L 0.895020,0.500000 L 0.694824,1.559570 L 3.062988,3.852539 L 0.527832,6.351563 L 0.689941,7.600586 L 2.967285,7.600586 L 4.897949,5.575195 L 6.854004,7.600586 L 9.115723,7.600586 L 9.277832,6.351563 L 6.742676,3.852539 Z" Fill="#FFFFFFFF" HorizontalAlignment="Center" Height="8" Margin="0,-1,0,0" Opacity="0.7" Stretch="Fill" VerticalAlignment="Center" Width="9">
<Path.Stroke>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#FF313131" Offset="1"/>
<GradientStop Color="#FF8E9092" Offset="0"/>
</LinearGradientBrush>
</Path.Stroke>
</Path>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Grid.Resources>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="WindowStates">
<VisualState x:Name="Open">
<Storyboard>
<DoubleAnimationUsingKeyFrames BeginTime="0" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="Overlay">
<EasingDoubleKeyFrame KeyTime="0" Value="0"/>
<EasingDoubleKeyFrame KeyTime="00:00:00.3" Value="1"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="0" Storyboard.TargetProperty="(RenderTransform).(Children)[0].ScaleX" Storyboard.TargetName="ContentRoot">
<SplineDoubleKeyFrame KeyTime="0" Value="0"/>
<SplineDoubleKeyFrame KeyTime="00:00:00.25" Value="0"/>
<SplineDoubleKeyFrame KeyTime="00:00:00.4" Value="1"/>
<SplineDoubleKeyFrame KeySpline="0,0,0.5,1" KeyTime="00:00:00.45" Value="1.05"/>
<SplineDoubleKeyFrame KeyTime="00:00:00.55" Value="1"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="0" Storyboard.TargetProperty="(RenderTransform).(Children)[0].ScaleY" Storyboard.TargetName="ContentRoot">
<SplineDoubleKeyFrame KeyTime="0" Value="0"/>
<SplineDoubleKeyFrame KeyTime="00:00:00.25" Value="0"/>
<SplineDoubleKeyFrame KeyTime="00:00:00.4" Value="1"/>
<SplineDoubleKeyFrame KeySpline="0,0,0.5,1" KeyTime="00:00:00.45" Value="1.05"/>
<SplineDoubleKeyFrame KeyTime="00:00:00.55" Value="1"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Closed">
<Storyboard>
<DoubleAnimationUsingKeyFrames BeginTime="0" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="Overlay">
<EasingDoubleKeyFrame KeyTime="0" Value="1"/>
<EasingDoubleKeyFrame KeyTime="00:00:00.3" Value="0"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="0" Storyboard.TargetProperty="(RenderTransform).(Children)[0].ScaleX" Storyboard.TargetName="ContentRoot">
<SplineDoubleKeyFrame KeyTime="00:00:00.2" Value="1"/>
<SplineDoubleKeyFrame KeyTime="00:00:00.25" Value="1.05"/>
<SplineDoubleKeyFrame KeyTime="00:00:00.45" Value="0"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="0" Storyboard.TargetProperty="(RenderTransform).(Children)[0].ScaleY" Storyboard.TargetName="ContentRoot">
<SplineDoubleKeyFrame KeyTime="00:00:00.2" Value="1"/>
<SplineDoubleKeyFrame KeyTime="00:00:00.25" Value="1.05"/>
<SplineDoubleKeyFrame KeyTime="00:00:00.45" Value="0"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Grid x:Name="Overlay" Background="{TemplateBinding OverlayBrush}" HorizontalAlignment="Stretch" Margin="0" Opacity="{TemplateBinding OverlayOpacity}" VerticalAlignment="Top"/>
<Grid x:Name="ContentRoot" HorizontalAlignment="{TemplateBinding HorizontalAlignment}" Height="{TemplateBinding Height}" RenderTransformOrigin="0.5,0.5" VerticalAlignment="{TemplateBinding VerticalAlignment}" Width="{TemplateBinding Width}">
<Grid.RenderTransform>
<TransformGroup>
<ScaleTransform/>
<SkewTransform/>
<RotateTransform/>
<TranslateTransform/>
</TransformGroup>
</Grid.RenderTransform>
<Border BorderBrush="#14000000" BorderThickness="1" Background="#14000000" CornerRadius="2" HorizontalAlignment="Stretch" Margin="-1" VerticalAlignment="Stretch"/>
<Border BorderBrush="#0F000000" BorderThickness="1" Background="#0F000000" CornerRadius="2.25" HorizontalAlignment="Stretch" Margin="-2" VerticalAlignment="Stretch"/>
<Border BorderBrush="#0C000000" BorderThickness="1" Background="#0C000000" CornerRadius="2.5" HorizontalAlignment="Stretch" Margin="-3" VerticalAlignment="Stretch"/>
<Border BorderBrush="#0A000000" BorderThickness="1" Background="#0A000000" CornerRadius="2.75" HorizontalAlignment="Stretch" Margin="-4" VerticalAlignment="Stretch"/>
<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="#FFFFFFFF" CornerRadius="2">
<Border CornerRadius="1.5" Margin="1">
<Border.Background>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#FFE5E8EB" Offset="1"/>
<GradientStop Color="#FFF6F8F9" Offset="0"/>
</LinearGradientBrush>
</Border.Background>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition/>
</Grid.RowDefinitions>
<Border x:Name="Chrome" BorderBrush="#FFFFFFFF" BorderThickness="0,0,0,1" Width="Auto" Background="{StaticResource LightBackground}">
<Grid Height="Auto" Width="Auto">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="30"/>
</Grid.ColumnDefinitions>
<ContentControl Content="{TemplateBinding Title}" FontWeight="Bold" HorizontalAlignment="Stretch" IsTabStop="False" Margin="6,0,6,0" VerticalAlignment="Center" Background="White" Foreground="White"/>
<Button x:Name="CloseButton1" Grid.Column="1" HorizontalAlignment="Center" Height="14" IsTabStop="False" Style="{StaticResource ButtonStyle}" VerticalAlignment="Center" Width="15" Foreground="White"/>
</Grid>
</Border>
<Border Background="{TemplateBinding Background}" Margin="0" Grid.Row="1">
<ContentPresenter x:Name="ContentPresenter" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Border>
</Grid>
</Border>
</Border>
</Grid>
</Grid>
</ControlTemplate>
HTH, Stimul8d

Resources