Transform xml file into r dataframe - r

Using R Studio 1.0.44 on a MacOS 10.12.1
This is my first time working with xml files and I'm having quite a bit of trouble..
I want to turn my xml file into an r data frame that looks something like this:
Date househouldid memberid session begin end
11/1/15 4FDYT14A1Q 1 235 49448 49453
11/1/15 4FDYT14A1Q 1 1010001 49453 49463
11/1/15 4FDYT14A1Q 1 1010475 49463 49468
I only want Date, householdid, memberid, session, begin and end in the data frame.
I tried...
xmldataframe<-xmlToDataFrame("DQA_audxml_20150105_EN.xml")
print(xmldataframe)
and got this...
destinations members regular_guests occasional_guests tvsets household_process
Here's part of the xml file (I'm restricted by the character count)..
<?xml version="1.0" encoding="UTF-8"?>
<households date="2015-01-05" creation_date="2015-01-11T04:22:35" xmlns:s="http://www.mediametrie.fr/nge/schemas" xmlns:xalan="http://xml.apache.org/xalan">
<household id="95D7N14AFA">
<destinations />
<members>
<member id="1">
<member_process result="OK" vacation="undefined">
<individual_audience />
<alarms />
</member_process>
</member>
<member id="2">
<member_process result="OK" vacation="undefined">
<individual_audience />
<alarms />
</member_process>
</member>
<member id="3">
<member_process result="OK" vacation="undefined">
<individual_audience />
<alarms />
</member_process>
</member>
</members>
<regular_guests />
<occasional_guests />
<tvsets>
<tvset id="1">
<tvset_process result="OK">
<tvset_audience />
<alarms>
<alarm id="AL_T_P_VALID_LAST_HOUR_REBOOT" rule_id="T_P_METER_STOPPING_TIMESTAMPING">
<parameters>
<parameter name="unique_id" value="149" />
<parameter name="reboot_date" value="2015-01-05T03:34:23" />
<parameter name="length" value="0.35116898148148146" />
</parameters>
</alarm>
<alarm id="AL_T_P_VALID_LAST_HOUR_REBOOT" rule_id="T_P_METER_STOPPING_TIMESTAMPING">
<parameters>
<parameter name="unique_id" value="150" />
<parameter name="reboot_date" value="2015-01-05T05:28:34" />
<parameter name="length" value="0.02806712962962963" />
</parameters>
</alarm>
<alarm id="AL_T_P_VALID_LAST_HOUR_REBOOT" rule_id="T_P_METER_STOPPING_TIMESTAMPING">
<parameters>
<parameter name="unique_id" value="151" />
<parameter name="reboot_date" value="2015-01-05T08:22:46" />
<parameter name="length" value="0.07322916666666666" />
</parameters>
</alarm>
<alarm id="AL_T_P_VALID_LAST_HOUR_REBOOT" rule_id="T_P_METER_STOPPING_TIMESTAMPING">
<parameters>
<parameter name="unique_id" value="152" />
<parameter name="reboot_date" value="2015-01-05T14:32:43" />
<parameter name="length" value="0.004803240740740742" />
</parameters>
</alarm>
<alarm id="AL_T_P_VALID_LAST_HOUR_REBOOT" rule_id="T_P_METER_STOPPING_TIMESTAMPING">
<parameters>
<parameter name="unique_id" value="153" />
<parameter name="reboot_date" value="2015-01-05T18:30:47" />
<parameter name="length" value="0.0012384259259259258" />
</parameters>
</alarm>
<alarm id="AL_T_P_VALID_LAST_HOUR_REBOOT" rule_id="T_P_METER_STOPPING_TIMESTAMPING">
<parameters>
<parameter name="unique_id" value="154" />
<parameter name="reboot_date" value="2015-01-06T02:52:01" />
<parameter name="length" value="0.33817129629629633" />
</parameters>
</alarm>
</alarms>
</tvset_process>
</tvset>
</tvsets>
<household_process result="OK" vacation="no">
<alarms />
</household_process>
</household>
<household id="ISDPN14ASG">
<destinations />
<members>
<member id="1">
<member_process result="OK" vacation="undefined">
<individual_audience />
<alarms />
</member_process>
</member>
<member id="2">
<member_process result="OK" vacation="undefined">
<individual_audience />
<alarms />
</member_process>
</member>
<member id="3">
<member_process result="OK" vacation="undefined">
<individual_audience />
<alarms />
</member_process>
</member>
<member id="4">
<member_process result="OK" vacation="undefined">
<individual_audience />
<alarms />
</member_process>
</member>
<member id="5">
<member_process result="OK" vacation="undefined">
<individual_audience />
<alarms />
</member_process>
</member>
</members>
<regular_guests />
<occasional_guests />
<tvsets>
<tvset id="1">
<tvset_process result="KO">
<tvset_audience />
<alarms>
<alarm id="AL_R_P_EVENT_CHRONOLOGY" rule_id="R_P_EVENT_CHRONOLOGY">
<parameters>
<parameter name="unique_id" value="16195" />
</parameters>
</alarm>
<alarm id="AL_PROCESS_STOP" rule_id="R_P_EVENT_CHRONOLOGY">
<parameters />
</alarm>
</alarms>
</tvset_process>
</tvset>
</tvsets>
<household_process result="KO" vacation="no">
<alarms>
<alarm id="AL_T_FP_HOUSEHOLD_ABS_DECLARATION" rule_id="T_FP_HOUSEHOLD_ABS_DECLARATION">
<parameters />
</alarm>
<alarm id="AL_R_FP_NO_TVSET_KO" rule_id="R_FP_NO_TVSET_KO">
<parameters>
<parameter name="tvset_id" value="1" />
</parameters>
</alarm>
<alarm id="AL_R_FP_AT_LEAST_ONE_TVSET_OK" rule_id="R_FP_AT_LEAST_ONE_TVSET_OK">
<parameters />
</alarm>
</alarms>
</household_process>
</household>
<household id="4FDYT14A1Q">
<destinations />
<members>
<member id="1">
<member_process result="OK" vacation="undefined">
<individual_audience />
<alarms />
</member_process>
</member>
<member id="2">
<member_process result="OK" vacation="undefined">
<individual_audience>
<individual_audience_tvset id="1">
<channel session="1010497" begin="46722" end="46738" />
<channel session="48" begin="46738" end="46743" />
<channel session="235" begin="46743" end="46748" />
<channel session="47" begin="46748" end="46753" />
<channel session="1010383" begin="46753" end="46973" />
<channel session="1010497" begin="46973" end="46983" />
<channel session="1010319" begin="46983" end="46993" />
<channel session="1010072" begin="46993" end="47578" />
<channel session="1010499" begin="47578" end="47618" />
<channel session="47" begin="47618" end="47633" />
<channel session="1010383" begin="47633" end="47693" />
<channel session="48" begin="47693" end="47703" />
<channel session="235" begin="47703" end="47728" />
<channel session="1010469" begin="47728" end="47778" />
<channel session="235" begin="47778" end="47783" />
<channel session="48" begin="47783" end="47828" />
<channel session="1010367" begin="47828" end="47853" />
<channel session="48" begin="47853" end="48373" />
<channel session="1010383" begin="48373" end="48573" />
<channel session="48" begin="48573" end="49433" />
<channel session="1010452" begin="49433" end="49448" />
<channel session="235" begin="49448" end="49453" />
<channel session="1010001" begin="49453" end="49463" />
<channel session="1010475" begin="49463" end="49468" />
<channel session="1010383" begin="49468" end="49483" />
<channel session="48" begin="49483" end="49508" />
<channel session="1010403" begin="49508" end="49543" />
<channel session="48" begin="49543" end="53839" />
<channel session="1010354" begin="60868" end="60878" />
<channel session="235" begin="60878" end="60893" />
<channel session="48" begin="60893" end="60908" />
<channel session="235" begin="60908" end="60913" />
<channel session="1010072" begin="60913" end="60928" />
<channel session="48" begin="60928" end="60933" />
<channel session="235" begin="60933" end="60938" />
<channel session="48" begin="60938" end="60943" />
<channel session="235" begin="60943" end="60953" />
<channel session="48" begin="60953" end="60968" />
<channel session="235" begin="60968" end="60993" />
<channel session="1010072" begin="60993" end="61483" />
<channel session="1010499" begin="61483" end="61538" />
<channel session="48" begin="61538" end="61543" />
<channel session="47" begin="61543" end="61578" />
<channel session="1010383" begin="61578" end="61603" />
<channel session="1010072" begin="61603" end="63428" />
<channel session="1010497" begin="63428" end="63438" />
<channel session="1010319" begin="63438" end="63888" />
<channel session="1010072" begin="63888" end="63898" />
<channel session="235" begin="63898" end="63903" />
<channel session="47" begin="63903" end="64368" />
<channel session="48" begin="64368" end="64373" />
<channel session="47" begin="64373" end="64378" />
<channel session="1010072" begin="64378" end="64393" />
<channel session="1010383" begin="64393" end="64408" />
<channel session="1010001" begin="64408" end="64423" />
<channel session="235" begin="64423" end="64428" />
<channel session="1010469" begin="64428" end="64468" />
<channel session="1010452" begin="64468" end="64473" />
<channel session="48" begin="64473" end="64528" />
<channel session="1010367" begin="64528" end="65053" />
<channel session="48" begin="65053" end="65328" />
<channel session="1010367" begin="65328" end="66613" />
<channel session="1010383" begin="66613" end="66628" />
<channel session="1010497" begin="66628" end="66823" />
<channel session="47" begin="66823" end="66833" />
<channel session="1010367" begin="66833" end="67538" />
<channel session="1010383" begin="67538" end="67553" />
<channel session="1010354" begin="67553" end="67563" />
<channel session="1010497" begin="67563" end="67658" />
<channel session="1010499" begin="67658" end="67713" />
<channel session="1010072" begin="67713" end="67733" />
<channel session="1010367" begin="67733" end="67803" />
<channel session="48" begin="67803" end="68018" />
<channel session="1010367" begin="68018" end="70963" />
<channel session="1010383" begin="70963" end="71048" />
<channel session="1010367" begin="71048" end="71848" />
<channel session="1010383" begin="71848" end="72023" />
<channel session="1010497" begin="72023" end="72043" />
<channel session="1010072" begin="72043" end="72068" />
<channel session="1010499" begin="72068" end="72083" />
<channel session="47" begin="72083" end="72098" />
<channel session="1010499" begin="72098" end="73643" />
<channel session="1010072" begin="73643" end="73668" />
<channel session="1010354" begin="73668" end="73683" />
<channel session="1010383" begin="73683" end="73693" />
<channel session="1010499" begin="73693" end="73708" />
<channel session="1010072" begin="73708" end="73748" />
<channel session="235" begin="73748" end="73753" />
<channel session="1010497" begin="73753" end="73763" />
<channel session="1010499" begin="73763" end="74323" />
<channel session="1010497" begin="74323" end="74363" />
<channel session="1010354" begin="74363" end="74378" />
<channel session="1010499" begin="74378" end="74443" />
<channel session="1010072" begin="74443" end="74453" />
<channel session="1010499" begin="74453" end="74883" />
<channel session="1010497" begin="74883" end="74938" />
<channel session="1010072" begin="74938" end="74953" />
<channel session="47" begin="74953" end="75603" />
<channel session="1010497" begin="75603" end="77673" />
<channel session="1010383" begin="77673" end="79208" />
<channel session="1010354" begin="79208" end="79228" />
<channel session="235" begin="79228" end="79233" />
<channel session="1010497" begin="79233" end="79603" />
<channel session="1010072" begin="79603" end="80088" />
<channel session="1010497" begin="80088" end="80238" />
<channel session="1010499" begin="80238" end="80253" />
<channel session="235" begin="80253" end="80258" />
<channel session="47" begin="80258" end="80423" />
<channel session="1010072" begin="80423" end="80678" />
<channel session="1010497" begin="80678" end="80688" />
<channel session="47" begin="80688" end="80853" />
<channel session="235" begin="80853" end="80858" />
<channel session="1010354" begin="80858" end="80868" />
<channel session="1010497" begin="80868" end="81428" />
<channel session="1010072" begin="81428" end="81438" />
<channel session="235" begin="81438" end="81448" />
<channel session="47" begin="81448" end="81453" />
<channel session="1010497" begin="81453" end="82108" />
<channel session="1010354" begin="82108" end="82528" />
<channel session="1010497" begin="82528" end="82538" />
<channel session="1010072" begin="82538" end="82548" />
<channel session="1010499" begin="82548" end="82608" />
<channel session="47" begin="82608" end="82628" />
<channel session="1010072" begin="82628" end="82648" />
<channel session="1010354" begin="82648" end="82973" />
<channel session="1010072" begin="82973" end="82983" />
<channel session="1010499" begin="82983" end="83273" />
<channel session="47" begin="83273" end="83313" />
<channel session="1010383" begin="83313" end="83393" />
<channel session="1010319" begin="83393" end="83443" />
<channel session="1010499" begin="83443" end="83498" />
<channel session="48" begin="83498" end="83688" />
<channel session="47" begin="83688" end="83883" />
<channel session="48" begin="83883" end="83898" />
<channel session="1010258" begin="83898" end="84193" />
<channel session="47" begin="84193" end="84198" />
<channel session="1010260" begin="84198" end="84253" />
<channel session="235" begin="84253" end="84258" />
<channel session="47" begin="84258" end="84273" />
<channel session="48" begin="84273" end="84423" />
<channel session="235" begin="84423" end="84433" />
<channel session="48" begin="84433" end="84448" />
<channel session="1010260" begin="84448" end="84463" />
<channel session="1010144" begin="84463" end="84578" />
<channel session="235" begin="84578" end="84583" />
<channel session="1010260" begin="84583" end="84628" />
<channel session="235" begin="84628" end="84633" />
<channel session="1010258" begin="84633" end="84643" />
<channel session="48" begin="84643" end="85088" />
<channel session="235" begin="85088" end="85098" />
<channel session="1010258" begin="85098" end="85113" />
<channel session="235" begin="85113" end="85118" />
<channel session="1010144" begin="85118" end="85163" />
<channel session="1010260" begin="85163" end="85178" />
<channel session="48" begin="85178" end="85398" />
<channel session="1010493" begin="85398" end="85418" />
<channel session="48" begin="85418" end="85428" />
<channel session="235" begin="85428" end="85433" />
<channel session="47" begin="85433" end="85488" />
<channel session="1010260" begin="85488" end="85493" />
<channel session="1010258" begin="85493" end="85638" />
<channel session="1010474" begin="85638" end="85785" />
</individual_audience_tvset>
</individual_audience>
<alarms />
</member_process>
</member>
<member id="3">
<member_process result="OK" vacation="undefined">
<individual_audience>
<individual_audience_tvset id="1">
<channel session="1010493" begin="54476" end="54490" />
<channel session="47" begin="54490" end="55035" />
<channel session="1010379" begin="55035" end="55210" />
<channel session="48" begin="55210" end="55220" />
<channel session="1010397" begin="55220" end="55570" />
<channel session="235" begin="55570" end="55580" />
<channel session="1010425" begin="55580" end="55585" />
<channel session="1010397" begin="55585" end="55620" />
<channel session="235" begin="55620" end="55625" />
<channel session="48" begin="55625" end="56875" />
<channel session="1010379" begin="56875" end="57345" />
<channel session="48" begin="57345" end="57615" />
<channel session="1010379" begin="57615" end="57865" />
<channel session="48" begin="57865" end="58079" />
</individual_audience_tvset>
</individual_audience>
<alarms />
</member_process>
</member>
<member id="4">
<member_process result="OK" vacation="undefined">
<individual_audience />
<alarms />
</member_process>
</member>
</members>
<regular_guests />
<occasional_guests />
<tvsets>
<tvset id="1">
<tvset_process result="OK">
<tvset_audience>
<channel session="1010497" begin="46708" end="46738" />
<channel session="48" begin="46738" end="46743" />
<channel session="235" begin="46743" end="46748" />
<channel session="47" begin="46748" end="46753" />
<channel session="1010383" begin="46753" end="46973" />
<channel session="1010497" begin="46973" end="46983" />
<channel session="1010319" begin="46983" end="46993" />
<channel session="1010072" begin="46993" end="47578" />
<channel session="1010499" begin="47578" end="47618" />
<channel session="47" begin="47618" end="47633" />
<channel session="1010383" begin="47633" end="47693" />
<channel session="48" begin="47693" end="47703" />
<channel session="235" begin="47703" end="47728" />
<channel session="1010469" begin="47728" end="47778" />
<channel session="235" begin="47778" end="47783" />
<channel session="48" begin="47783" end="47828" />
<channel session="1010367" begin="47828" end="47853" />
<channel session="48" begin="47853" end="48373" />
<channel session="1010383" begin="48373" end="48573" />
<channel session="48" begin="48573" end="49433" />
<channel session="1010452" begin="49433" end="49448" />
<channel session="235" begin="49448" end="49453" />
<channel session="1010001" begin="49453" end="49463" />
<channel session="1010475" begin="49463" end="49468" />
<channel session="1010383" begin="49468" end="49483" />
<channel session="48" begin="49483" end="49508" />
<channel session="1010403" begin="49508" end="49543" />
<channel session="48" begin="49543" end="53839" />
<channel session="1010493" begin="54460" end="54490" />
<channel session="47" begin="54490" end="55035" />
<channel session="1010379" begin="55035" end="55210" />
<channel session="48" begin="55210" end="55220" />
<channel session="1010397" begin="55220" end="55570" />
<channel session="235" begin="55570" end="55580" />
<channel session="1010425" begin="55580" end="55585" />
<channel session="1010397" begin="55585" end="55620" />
<channel session="235" begin="55620" end="55625" />
<channel session="48" begin="55625" end="56875" />
<channel session="1010379" begin="56875" end="57345" />
<channel session="48" begin="57345" end="57615" />
<channel session="1010379" begin="57615" end="57865" />
<channel session="48" begin="57865" end="58079" />
<channel session="1010354" begin="60848" end="60878" />
<channel session="235" begin="60878" end="60893" />
<channel session="48" begin="60893" end="60908" />
<channel session="235" begin="60908" end="60913" />
<channel session="1010072" begin="60913" end="60928" />
<channel session="48" begin="60928" end="60933" />
<channel session="235" begin="60933" end="60938" />
<channel session="48" begin="60938" end="60943" />
<channel session="235" begin="60943" end="60953" />
<channel session="48" begin="60953" end="60968" />
<channel session="235" begin="60968" end="60993" />
<channel session="1010072" begin="60993" end="61483" />
<channel session="1010499" begin="61483" end="61538" />
<channel session="48" begin="61538" end="61543" />
<channel session="47" begin="61543" end="61578" />
<channel session="1010383" begin="61578" end="61603" />
<channel session="1010072" begin="61603" end="63428" />
<channel session="1010497" begin="63428" end="63438" />
<channel session="1010319" begin="63438" end="63888" />
<channel session="1010072" begin="63888" end="63898" />
<channel session="235" begin="63898" end="63903" />
<channel session="47" begin="63903" end="64368" />
<channel session="48" begin="64368" end="64373" />
<channel session="47" begin="64373" end="64378" />
<channel session="1010072" begin="64378" end="64393" />
<channel session="1010383" begin="64393" end="64408" />
<channel session="1010001" begin="64408" end="64423" />
<channel session="235" begin="64423" end="64428" />
<channel session="1010469" begin="64428" end="64468" />
<channel session="1010452" begin="64468" end="64473" />
<channel session="48" begin="64473" end="64528" />
<channel session="1010367" begin="64528" end="65053" />
<channel session="48" begin="65053" end="65328" />
<channel session="1010367" begin="65328" end="66613" />
<channel session="1010383" begin="66613" end="66628" />
<channel session="1010497" begin="66628" end="66823" />
<channel session="47" begin="66823" end="66833" />
<channel session="1010367" begin="66833" end="67538" />
<channel session="1010383" begin="67538" end="67553" />
<channel session="1010354" begin="67553" end="67563" />
<channel session="1010497" begin="67563" end="67658" />
<channel session="1010499" begin="67658" end="67713" />
<channel session="1010072" begin="67713" end="67733" />
<channel session="1010367" begin="67733" end="67803" />
<channel session="48" begin="67803" end="68018" />
<channel session="1010367" begin="68018" end="70963" />
<channel session="1010383" begin="70963" end="71048" />
<channel session="1010367" begin="71048" end="71848" />
<channel session="1010383" begin="71848" end="72023" />
<channel session="1010497" begin="72023" end="72043" />
<channel session="1010072" begin="72043" end="72068" />
<channel session="1010499" begin="72068" end="72083" />
<channel session="47" begin="72083" end="72098" />
<channel session="1010499" begin="72098" end="73643" />
<channel session="1010072" begin="73643" end="73668" />
<channel session="1010354" begin="73668" end="73683" />
<channel session="1010383" begin="73683" end="73693" />
<channel session="1010499" begin="73693" end="73708" />
<channel session="1010072" begin="73708" end="73748" />
<channel session="235" begin="73748" end="73753" />
<channel session="1010497" begin="73753" end="73763" />
<channel session="1010499" begin="73763" end="74323" />
<channel session="1010497" begin="74323" end="74363" />
<channel session="1010354" begin="74363" end="74378" />
<channel session="1010499" begin="74378" end="74443" />
<channel session="1010072" begin="74443" end="74453" />
<channel session="1010499" begin="74453" end="74883" />
<channel session="1010497" begin="74883" end="74938" />
<channel session="1010072" begin="74938" end="74953" />
<channel session="47" begin="74953" end="75603" />
<channel session="1010497" begin="75603" end="77673" />
<channel session="1010383" begin="77673" end="79208" />
<channel session="1010354" begin="79208" end="79228" />
<channel session="235" begin="79228" end="79233" />
<channel session="1010497" begin="79233" end="79603" />
<channel session="1010072" begin="79603" end="80088" />
<channel session="1010497" begin="80088" end="80238" />
<channel session="1010499" begin="80238" end="80253" />
<channel session="235" begin="80253" end="80258" />

This is all just elbow grease and being familiar with how XML is structured. The relatively new purrr package is very useful here. But, I think your question is still a bit vague and the lack of a valid XML file is more than problematic:
library(xml2)
library(purrr)
library(dplyr)
hh <- read_xml("~/data/so.xml")
xml_find_all(hh, ".//household") %>%
map_df(function(x) {
id <- xml_attr(x, "id")
members <- xml_find_all(x, ".//member")
map_df(members, function(y) {
channel_sessions <- xml_find_all(y, ".//channel")
if (length(channel_sessions) == 0) {
NULL
} else {
xml_attrs(channel_sessions) %>%
map_df(as.list) %>%
mutate(memberid=xml_attr(y, "id"),
household=id)
}
})
}) %>%
mutate(date=xml_find_first(hh, "//households") %>%
xml_attr("creation_date") %>%
as.Date())
## # A tibble: 176 × 6
## session begin end memberid household date
## <chr> <chr> <chr> <chr> <chr> <date>
## 1 1010497 46722 46738 2 4FDYT14A1Q 2015-01-11
## 2 48 46738 46743 2 4FDYT14A1Q 2015-01-11
## 3 235 46743 46748 2 4FDYT14A1Q 2015-01-11
## 4 47 46748 46753 2 4FDYT14A1Q 2015-01-11
## 5 1010383 46753 46973 2 4FDYT14A1Q 2015-01-11
## 6 1010497 46973 46983 2 4FDYT14A1Q 2015-01-11
## 7 1010319 46983 46993 2 4FDYT14A1Q 2015-01-11
## 8 1010072 46993 47578 2 4FDYT14A1Q 2015-01-11
## 9 1010499 47578 47618 2 4FDYT14A1Q 2015-01-11
## 10 47 47618 47633 2 4FDYT14A1Q 2015-01-11
## # ... with 166 more rows

With words of transform and xml in same title, consider XSLT, the special-purpose language designed to transform source XML files into end use needs such as import into R dataframes. Now the challenge presented is R does not have a dedicated library to run XSLT.
Nonetheless, R can call command lines to external processers (even in other languages like Python, PHP, Java, etc.) to convert input to output. Below are two versions: for Windows (using Powershell's call to XslCompiledTransform) and Linux/Mac (using xsltproc usually installed on most distributions):
XSLT Script (save as .xsl, a well-formed xml file)
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output version="1.0" encoding="UTF-8" indent="yes" />
<xsl:strip-space elements="*"/>
<xsl:template match="/households">
<xsl:copy>
<xsl:apply-templates select="household"/>
</xsl:copy>
</xsl:template>
<xsl:template match="household|members|member|member_process|individual_audience|individual_audience_tvset">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="channel">
<tvset>
<date><xsl:value-of select="ancestor::households/#date"/></date>
<household_id><xsl:value-of select="ancestor::household/#id"/></household_id>
<member_id><xsl:value-of select="ancestor::member/#id"/></member_id>
<session><xsl:value-of select="#session"/></session>
<begin><xsl:value-of select="#begin"/></begin>
<end><xsl:value-of select="#end"/></end>
</tvset>
</xsl:template>
<xsl:template match="tvsets"/>
</xsl:transform>
PowerShell Script (save as .ps1 file, for Windows only)
param ($xml, $xsl, $output)
if (-not $xml -or -not $xsl -or -not $output) {
Write-Host "& .\xslt.ps1 [-xml] xml-input [-xsl] xsl-input [-output] transform-output"
exit;
}
trap [Exception]{
Write-Host $_.Exception;
}
$xslt = New-Object System.Xml.Xsl.XslCompiledTransform;
$xslt.Load($xsl);
$xslt.Transform($xml, $output);
Write-Host "generated" $output;
R (Windows)
library(XML)
system(paste0('Powershell.exe -File',
' "C:\\Path\\To\\PowerShell\\Script.ps1"',
' "C:\\Path\\To\\Input.xml"',
' "C:\\Path\\To\\XSLT\\Script.xsl"',
' "C:\\Path\\To\\Output.xml"'))
df <- xmlToDataFrame("C:\\Path\\To\\Output.xml")
head(df, 10)
# date household_id member_id session begin end
# 1 2015-01-05 4FDYT14A1Q 2 1010497 46722 46738
# 2 2015-01-05 4FDYT14A1Q 2 48 46738 46743
# 3 2015-01-05 4FDYT14A1Q 2 235 46743 46748
# 4 2015-01-05 4FDYT14A1Q 2 47 46748 46753
# 5 2015-01-05 4FDYT14A1Q 2 1010383 46753 46973
# 6 2015-01-05 4FDYT14A1Q 2 1010497 46973 46983
# 7 2015-01-05 4FDYT14A1Q 2 1010319 46983 46993
# 8 2015-01-05 4FDYT14A1Q 2 1010072 46993 47578
# 9 2015-01-05 4FDYT14A1Q 2 1010499 47578 47618
# 10 2015-01-05 4FDYT14A1Q 2 47 47618 47633
R (Linux/Mac)
library(XML)
system('xsltproc /path/to/XSLT_Script.xsl /path/to/Input.xml -o path/to/Output.xml')
df <- xmlToDataFrame("path/to/Output.xml")

Related

status="NotProcessed" for EnhancedAirBookRQ API

Can anyone help me in this regard, checking with Sabre Soap API's for booking flow. I am getting the failure in EnhancedAirBookRQ response.
I am getting the below response :
<ApplicationResults status="NotProcessed" xmlns="http://services.sabre.com/STL_Payload/v02_01">
<Error type="BusinessLogic" timeStamp="2018-10-01T05:38:45.063-05:00">
<SystemSpecificResults>
<Message code="ERR.SWS.HOST.ERROR_IN_RESPONSE">*NO FARES/RBD/CARRIER</Message>
<Message code="146">*NO FARES/RBD/CARRIER</Message>
</SystemSpecificResults>
</Error>
</ApplicationResults>
Request:
<v3:EnhancedAirBookRQ version="3.2.0" HaltOnError="true" IgnoreOnError="true">
<v3:OTA_AirBookRQ>
<v3:OriginDestinationInformation>
<v3:FlightSegment ArrivalDateTime="2018-11-11T07:38:00" DepartureDateTime="2018-11-11T06:31:00" FlightNumber="6384" NumberInParty="1" ResBookDesigCode="K" Status="NN">
<v3:DestinationLocation LocationCode="BOS" />
<v3:Equipment AirEquipType="E90" />
<v3:MarketingAirline Code="TP" FlightNumber="6384" />
<v3:MarriageGrp Ind="false" />
<v3:OperatingAirline Code="B6" />
<v3:OriginLocation LocationCode="JFK" />
</v3:FlightSegment>
<v3:FlightSegment ArrivalDateTime="2018-11-12T06:00:00" DepartureDateTime="2018-11-11T18:40:00" FlightNumber="218" NumberInParty="1" ResBookDesigCode="K" Status="NN">
<v3:DestinationLocation LocationCode="LIS" />
<v3:Equipment AirEquipType="332" />
<v3:MarketingAirline Code="TP" FlightNumber="218" />
<v3:MarriageGrp Ind="true" />
<v3:OperatingAirline Code="TP" />
<v3:OriginLocation LocationCode="BOS" />
</v3:FlightSegment>
<v3:FlightSegment ArrivalDateTime="2018-11-12T12:20:00" DepartureDateTime="2018-11-12T08:40:00" FlightNumber="6791" NumberInParty="1" ResBookDesigCode="K" Status="NN">
<v3:DestinationLocation LocationCode="LUX" />
<v3:Equipment AirEquipType="73H" />
<v3:MarketingAirline Code="TP" FlightNumber="6791" />
<v3:MarriageGrp Ind="true" />
<v3:OperatingAirline Code="LG" />
<v3:OriginLocation LocationCode="LIS" />
</v3:FlightSegment>
<v3:FlightSegment ArrivalDateTime="2018-11-15T12:25:00" DepartureDateTime="2018-11-15T10:55:00" FlightNumber="3761" NumberInParty="1" ResBookDesigCode="X" Status="NN">
<v3:DestinationLocation LocationCode="OPO" />
<v3:Equipment AirEquipType="73W" />
<v3:MarketingAirline Code="LG" FlightNumber="3761" />
<v3:MarriageGrp Ind="false" />
<v3:OperatingAirline Code="LG" />
<v3:OriginLocation LocationCode="LUX" />
</v3:FlightSegment>
<v3:FlightSegment ArrivalDateTime="2018-11-15T15:30:00" DepartureDateTime="2018-11-15T14:30:00" FlightNumber="1947" NumberInParty="1" ResBookDesigCode="W" Status="NN">
<v3:DestinationLocation LocationCode="LIS" />
<v3:Equipment AirEquipType="AT7" />
<v3:MarketingAirline Code="TP" FlightNumber="1947" />
<v3:MarriageGrp Ind="false" />
<v3:OperatingAirline Code="WI" />
<v3:OriginLocation LocationCode="OPO" />
</v3:FlightSegment>
<v3:FlightSegment ArrivalDateTime="2018-11-15T20:00:00" DepartureDateTime="2018-11-15T17:00:00" FlightNumber="209" NumberInParty="1" ResBookDesigCode="W" Status="NN">
<v3:DestinationLocation LocationCode="JFK" />
<v3:Equipment AirEquipType="332" />
<v3:MarketingAirline Code="TP" FlightNumber="209" />
<v3:MarriageGrp Ind="true" />
<v3:OperatingAirline Code="TP" />
<v3:OriginLocation LocationCode="LIS" />
</v3:FlightSegment>
</v3:OriginDestinationInformation>
</v3:OTA_AirBookRQ>
<v3:OTA_AirPriceRQ>
<!--v3:PriceComparison /-->
<v3:PriceRequestInformation Retain="true">
<v3:OptionalQualifiers>
<v3:PricingQualifiers>
<v3:PassengerType Code="ADT" Quantity="1" />
</v3:PricingQualifiers>
</v3:OptionalQualifiers>
</v3:PriceRequestInformation>
</v3:OTA_AirPriceRQ>
<v3:PostProcessing IgnoreAfter="false" />
<v3:PreProcessing IgnoreBefore="false" />
</v3:EnhancedAirBookRQ>
Checking this test step in soap ui project given by Sabre on their developer portal. Before this, checked for test-steps for create session and low fare search for flights.
Can anyone tell any way to resolve on this. Thanks for any help.
EnhancedAirBookRQ flight details are not correct. Please verify or use search API again to fetch correct details

log4net AdoNetAppender in .Net core not supported?

I'm trying to implement log4net 2.0.8 in our dot net core 1.1.2 app. The ConsoleAppender is working fine, but the AdoNetAppender throws an error:
Could not load type 'log4net.Appender.AdoNetAppender'
Is AdoNetAppender still not supported in Dot Net Core?
My config:
<?xml version="1.0" encoding="utf-8" ?>
<log4net debug="true">
<appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender">
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date{ABSOLUTE} [%thread] %-5level %logger: %message%newline" />
</layout>
</appender>
<appender name="AdoNetAppender" type="log4net.Appender.AdoNetAppender">
<bufferSize value="1" />
<connectionType value="System.Data.SqlClient.SqlConnection, System.Data, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<connectionString value="data source=MyMSSQLServer; initial catalog=MyDatabase;integrated security=false;persist security info=True;User ID=sa;Password=***" />
<commandText value="dbo.prcLog4Net_LogMsg" />
<commandType value="StoredProcedure" />
<parameter>
<parameterName value="#session_id" />
<dbType value="Int" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%property{session_id}" />
</layout>
</parameter>
<parameter>
<parameterName value="#message" />
<dbType value="AnsiString" />
<size value="4000" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%message" />
</layout>
</parameter>
</appender>
<root>
<level value="DEBUG" />
<appender-ref ref="ConsoleAppender" />
<appender-ref ref="AdoNetAppender" />
</root>
</log4net>
The ado.net appender is not supported, you can look it up in the following page:
framework-support.html#Appenders

Alfresco custom model - not showing in worklow

I am trying to add a text field to the standard adhoc workflow but the field never appears on the screen. I have tried added some other standard bpm: fields to the view and they get displayed but not the custom one.
Is there anything obvious I am missing?
I have cloned the workflow and added the following.
Workflow model:
<?xml version="1.0" encoding="UTF-8"?>
<!-- Definition of new Model -->
<model name="lhwf:workflowmodel"
xmlns="http://www.alfresco.org/model/dictionary/1.0">
<!-- Optional meta-data about the model -->
<description>Workflow Model</description>
<author>O</author>
<version>1.0</version>
<!-- Imports are required to allow references to definitions in other models -->
<imports>
<import uri="http://www.alfresco.org/model/dictionary/1.0"
prefix="d" />
<import uri="http://www.alfresco.org/model/bpm/1.0"
prefix="bpm" />
<import uri="http://www.alfresco.org/model/workflow/1.0"
prefix="wf"/>
</imports>
<!-- Introduction of new namespaces defined by this model -->
<namespaces>
<namespace uri="http://www.test.com/model/workflow/1.0"
prefix="lhwf" />
</namespaces>
<types>
<type name="lhwf:submitMyTask">
<parent>bpm:startTask</parent>
<properties>
<property name="lhwf:actionRequired">
<type>d:text</type>
<mandatory>true</mandatory>
<multiple>false</multiple>
</property>
</properties>
</type>
</types>
</model>
The share-config-custom.xml file looks like this
<alfresco-config>
<config evaluator="string-compare" condition="activiti$activitiAdhoc2">
<forms>
<form>
<field-visibility>
<show id="bpm:workflowDescription" />
<show id="lhwf:actionRequired" />
<show id="bpm:workflowDueDate" />
` <show id="bpm:workflowPriority" />
<show id="bpm:assignee" />
<show id="packageItems" />
<show id="bpm:sendEMailNotifications" />
</field-visibility>
<appearance>
<set id="" appearance="title" label-id="workflow.set.general" />
<set id="info" appearance="" template="/org/alfresco/components/form/2-column-set.ftl" />
<set id="assignee" appearance="title" label-id="workflow.set.assignee" />
<set id="items" appearance="title" label-id="workflow.set.items" />
<set id="other" appearance="title" label-id="workflow.set.other" />
<field id="bpm:workflowDescription" label="Title">
<control template="/org/alfresco/components/form/controls/textarea.ftl">
<control-param name="style">width: 95%</control-param>
</control>
</field>
<field id="lhwf:actionRequired" label="Action Required" set="info" />
<field id="bpm:workflowDueDate" label-id="workflow.field.due" set="info">
<control template="/org/alfresco/components/form/controls/date.ftl">
<control-param name="showTime">false</control-param>
<control-param name="submitTime">false</control-param>
</control>
</field>
<field id="bpm:workflowPriority" label-id="workflow.field.priority" set="info">
<control template="/org/alfresco/components/form/controls/workflow/priority.ftl" />
</field>
<field id="bpm:assignee" label-id="workflow.field.assign_to" set="assignee" />
<field id="packageItems" set="items" />
<field id="bpm:sendEMailNotifications" set="other">
<control template="/org/alfresco/components/form/controls/workflow/email-notification.ftl" />
</field>
</appearance>
</form>
</forms>
</config>
Thanks in advance
O
I would recommend the following.
<show id="lhwf:actionRequired" force="true"/>
Can you please share the bpmn file here?

Need to understand Log4Net Configuration section WebForm

i was thinking to use Log4Net for our webform application in asp.net. so i checked few article on this but i saw all article not saying about each property regarding configuration.
so i apologized that i have to paste bit big config section here and looking for some one who can help me to understand each property usage.
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<log4net>
<appender name="DbAppender" type="log4net.Appender.ADONetAppender">
<bufferSize value="0" />
<connectionType value="System.Data.SqlClient.SqlConnection, System.Data, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<connectionString value="{auto}" />
<commandText value="INSERT INTO Log4Net ([date],[thread],[level],[logger],[message],[exception]) VALUES
(#log_date, #thread, #log_level, #logger, #message, #exception)" />
<parameter>
<parameterName value="#log_date" />
<dbType value="DateTime" />
<layout type="log4net.Layout.RawTimeStampLayout" />
</parameter>
<parameter>
<parameterName value="#thread" />
<dbType value="String" />
<size value="255" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%t" />
</layout>
</parameter>
<parameter>
<parameterName value="#log_level" />
<dbType value="String" />
<size value="10" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%p" />
</layout>
</parameter>
<parameter>
<parameterName value="#logger" />
<dbType value="String" />
<size value="1000" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%c" />
</layout>
</parameter>
<parameter>
<parameterName value="#message" />
<dbType value="String" />
<size value="4000" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%m" />
</layout>
</parameter>
<parameter>
<parameterName value="#exception" />
<dbType value="String" />
<size value="4000" />
<layout type="log4net.Layout.ExceptionLayout" />
</parameter>
</appender>
<root>
<level value="INFO" />
<appender-ref ref="RollingFileAppender" />
<appender-ref ref="DbAppender" />
</root>
</log4net>
</configuration>
please see the above config details and answer each property.
1) why <bufferSize value="0" /> is set to 0 ? when one should set other value to bufferSize property ?
2) <connectionType value="System.Data.SqlClient.SqlConnection, System.Data, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
how do i know what PublicKeyToken value i need to use.
3) what is the meaning of connection string auto <connectionString value="{auto}" /> ?
4)
what is the meaning of conversionPattern or
5 what is ExceptionLayout <layout type="log4net.Layout.ExceptionLayout" />
6) what is the meaning of below xml
<root>
<level value="INFO" />
<appender-ref ref="RollingFileAppender" />
<appender-ref ref="DbAppender" />
</root>
what is RollingFileAppender ?
what is DbAppender ?
please discuss about my each point & question. thanks
1/ bufferSize <= 1 means no buffering. Log is written instantly to the database.
http://logging.apache.org/log4net/release/sdk/log4net.Appender.BufferingAppenderSkeleton.BufferSize.html
2/ PublicKeyToken is not Log4net related. Have a look. Keep the given token.
3/ {auto} in connectionString seems to be custom code, maybe taken from here
4/ List of conversion patterns
5/ Exception layout: only the exception text from the logging event will be logged.
http://logging.apache.org/log4net/release/sdk/log4net.Layout.ExceptionLayout.html
6/
FileAppender -> log to file.
RollingFileAppender -> log to file with rotating logs (max N files of length L, then they are erased).
DbAppender -> log to database, that's why there is a connectionString.
More info: http://logging.apache.org/log4net/release/config-examples.html

BizTalk - mapping a source that has a Parent-Child relationship a flat destination

I have seen this question about a parent child relationship, but it is not exactly the same since I have nothing to tag with.
I have a source flat file that look like this
Location Route Prod Company Date Amount
XXX RT00008 UT COMPANY1 20110926 3
XXX RT00008 UT COMPANY1 20110927 1
XXX RT00008 UT COMPANY1 20110928 1
XXX RT00008 UT COMPANY1 20110929 1
XXX RT00008 UT COMPANY1 20110930 1
XXX RT00171 SPW COMPANY2 20110928 1
XXX RT00171 UT COMPANY2 20110926 1
XXX RT00171 UT COMPANY2 20110927 1
XXX RT00171 UT COMPANY2 20110928 1
Here is the killer, for each unique combination of Route, Prod, and Company I need one record with the days of week filled in. For instance the previous example should map into 3 separate rows in the output.
Loc, Route, Pr, Company, Sun, Mon, Tues, Wed, Thur, Fri, Sat
XXX, RT00008, UT, COMPANY1, 0, 3, 1, 1, 1, 1, 1
XXX, RT00171, SPW, COMPANY2, 0, 0, 0, 1, 0, 0, 0
XXX, RT00171, UT, COMPANY2, 0, 1, 1, 1, 0, 0, 0
Now my question is, is there a way to do this without XSLT? Can it be done by using functoid, in one or more series of maps? It seems like the table looping functoid is custom built for the opposite of this situation, can it be done in reverse? If it can only be done using XSLT I am still scratching my head on how to do it?
Thanks for any help!
I created two schema representations of your Flat files (not flat file schemas, but they will suffice for the illustration).
I started with a biztalk map thats would populate the first day with the appropriate value for a given combo of Company, Route and Prod. I went to xsl to allow it loop through a collection of identified combos to populate ALL days for the identified combo.
Its probably best that you load up the .btm supplied along with the schemas and xsl to see what I've done. I can explain anything thats unclear.
Its probably worth noting that you could tidy up the solution but I hope it gives you a pointer.
Two points to note: the "day" nodes are only created when a value exists for that day. You can change this in the xsl.
And, I used a valid date time to test (e.g. 26-09-2011) so you'll have to parse your date when determining what DayOfWeek your date is.
The first Schema:
<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns="http://BizTalk_Server_Project2.Schema1" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" targetNamespace="http://BizTalk_Server_Project2.Schema1" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="Root">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="1" maxOccurs="unbounded" name="Record">
<xs:complexType>
<xs:sequence>
<xs:element name="Location" type="xs:string" />
<xs:element name="Route" type="xs:string" />
<xs:element name="Prod" type="xs:string" />
<xs:element name="Company" type="xs:string" />
<xs:element name="Date" type="xs:string" />
<xs:element name="Amount" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
The second schema:
<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns="http://BizTalk_Server_Project2.Schema2" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" targetNamespace="http://BizTalk_Server_Project2.Schema2" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="Root">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="1" maxOccurs="unbounded" name="Record">
<xs:complexType>
<xs:sequence>
<xs:element name="Loc" type="xs:string" />
<xs:element name="Route" type="xs:string" />
<xs:element name="Pr" type="xs:string" />
<xs:element name="Company" type="xs:string" />
<xs:element name="Sun" type="xs:string" />
<xs:element name="Mon" type="xs:string" />
<xs:element name="Tue" type="xs:string" />
<xs:element name="Wed" type="xs:string" />
<xs:element name="Thurs" type="xs:string" />
<xs:element name="Friday" type="xs:string" />
<xs:element name="Sat" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
The BizTalk Map:
<?xml version="1.0" encoding="utf-16"?>
<mapsource Name="BizTalk Map" Version="2" BizTalkServerMapperTool_Version="3.0" XRange="100" YRange="420" OmitXmlDeclaration="Yes" TreatElementsAsRecords="No" OptimizeValueMapping="Yes" GenerateDefaultFixedNodes="Yes" PreserveSequenceOrder="No" IgnoreNamespacesForLinks="Yes" method="xml" CopyPIs="No" xmlVersion="1.0">
<SrcTree RootNode_Name="Root">
<Reference Location=".\Schema1.xsd" />
</SrcTree>
<TrgTree RootNode_Name="Root">
<Reference Location=".\Schema2.xsd" />
</TrgTree>
<ScriptTypePrecedence>
<CSharp Enabled="Yes" />
<ExternalAssembly Enabled="Yes" />
<VbNet Enabled="Yes" />
<JScript Enabled="Yes" />
<XsltCallTemplate Enabled="Yes" />
<Xslt Enabled="Yes" />
</ScriptTypePrecedence>
<TreeValues>
<TestValues />
<ConstantValues />
</TreeValues>
<CustomXSLT XsltPath=".\Map1.xsl" ExtObjXmlPath=".\Map1_extxml.xml" />
<Pages>
<Page Name="Page 1">
<Links>
<Link LinkID="22" LinkFrom="/*[local-name()='<Schema>']/*[local-name()='Root']/*[local-name()='Record']/*[local-name()='Date']" LinkTo="107" />
<Link LinkID="19" LinkFrom="/*[local-name()='<Schema>']/*[local-name()='Root']/*[local-name()='Record']/*[local-name()='Company']" LinkTo="106" />
<Link LinkID="16" LinkFrom="/*[local-name()='<Schema>']/*[local-name()='Root']/*[local-name()='Record']/*[local-name()='Prod']" LinkTo="105" />
<Link LinkID="14" LinkFrom="/*[local-name()='<Schema>']/*[local-name()='Root']/*[local-name()='Record']/*[local-name()='Route']" LinkTo="104" />
<Link LinkID="20" LinkFrom="106" LinkTo="/*[local-name()='<Schema>']/*[local-name()='Root']/*[local-name()='Record']/*[local-name()='Company']" />
<Link LinkID="15" LinkFrom="104" LinkTo="/*[local-name()='<Schema>']/*[local-name()='Root']/*[local-name()='Record']/*[local-name()='Route']" />
<Link LinkID="11" LinkFrom="103" LinkTo="/*[local-name()='<Schema>']/*[local-name()='Root']/*[local-name()='Record']/*[local-name()='Loc']" />
<Link LinkID="10" LinkFrom="/*[local-name()='<Schema>']/*[local-name()='Root']/*[local-name()='Record']/*[local-name()='Location']" LinkTo="103" />
<Link LinkID="18" LinkFrom="102" LinkTo="106" />
<Link LinkID="13" LinkFrom="102" LinkTo="105" />
<Link LinkID="12" LinkFrom="102" LinkTo="104" />
<Link LinkID="9" LinkFrom="102" LinkTo="103" />
<Link LinkID="1" LinkFrom="98" LinkTo="/*[local-name()='<Schema>']/*[local-name()='Root']" />
<Link LinkID="8" LinkFrom="101" LinkTo="102" />
<Link LinkID="6" LinkFrom="99" LinkTo="101" />
<Link LinkID="21" LinkFrom="/*[local-name()='<Schema>']/*[local-name()='Root']/*[local-name()='Record']/*[local-name()='Company']" LinkTo="100" />
<Link LinkID="3" LinkFrom="/*[local-name()='<Schema>']/*[local-name()='Root']/*[local-name()='Record']/*[local-name()='Route']" LinkTo="100" />
<Link LinkID="4" LinkFrom="/*[local-name()='<Schema>']/*[local-name()='Root']/*[local-name()='Record']/*[local-name()='Prod']" LinkTo="100" />
<Link LinkID="5" LinkFrom="100" LinkTo="99" />
<Link LinkID="24" LinkFrom="107" LinkTo="109" />
<Link LinkID="31" LinkFrom="109" LinkTo="117" />
<Link LinkID="38" LinkFrom="/*[local-name()='<Schema>']/*[local-name()='Root']/*[local-name()='Record']/*[local-name()='Amount']" LinkTo="117" />
<Link LinkID="30" LinkFrom="108" LinkTo="116" />
<Link LinkID="23" LinkFrom="107" LinkTo="108" />
<Link LinkID="37" LinkFrom="/*[local-name()='<Schema>']/*[local-name()='Root']/*[local-name()='Record']/*[local-name()='Amount']" LinkTo="116" />
<Link LinkID="33" LinkFrom="110" LinkTo="119" />
<Link LinkID="32" LinkFrom="112" LinkTo="118" />
<Link LinkID="34" LinkFrom="113" LinkTo="120" />
<Link LinkID="35" LinkFrom="114" LinkTo="121" />
<Link LinkID="36" LinkFrom="115" LinkTo="122" />
<Link LinkID="26" LinkFrom="107" LinkTo="110" />
<Link LinkID="25" LinkFrom="107" LinkTo="112" />
<Link LinkID="27" LinkFrom="107" LinkTo="113" />
<Link LinkID="28" LinkFrom="107" LinkTo="114" />
<Link LinkID="29" LinkFrom="107" LinkTo="115" />
<Link LinkID="39" LinkFrom="/*[local-name()='<Schema>']/*[local-name()='Root']/*[local-name()='Record']/*[local-name()='Amount']" LinkTo="118" />
<Link LinkID="40" LinkFrom="/*[local-name()='<Schema>']/*[local-name()='Root']/*[local-name()='Record']/*[local-name()='Amount']" LinkTo="119" />
<Link LinkID="41" LinkFrom="/*[local-name()='<Schema>']/*[local-name()='Root']/*[local-name()='Record']/*[local-name()='Amount']" LinkTo="120" />
<Link LinkID="42" LinkFrom="/*[local-name()='<Schema>']/*[local-name()='Root']/*[local-name()='Record']/*[local-name()='Amount']" LinkTo="121" />
<Link LinkID="43" LinkFrom="/*[local-name()='<Schema>']/*[local-name()='Root']/*[local-name()='Record']/*[local-name()='Amount']" LinkTo="122" />
<Link LinkID="17" LinkFrom="105" LinkTo="/*[local-name()='<Schema>']/*[local-name()='Root']/*[local-name()='Record']/*[local-name()='Pr']" />
<Link LinkID="44" LinkFrom="116" LinkTo="/*[local-name()='<Schema>']/*[local-name()='Root']/*[local-name()='Record']/*[local-name()='Sun']" />
<Link LinkID="45" LinkFrom="117" LinkTo="/*[local-name()='<Schema>']/*[local-name()='Root']/*[local-name()='Record']/*[local-name()='Mon']" />
<Link LinkID="46" LinkFrom="118" LinkTo="/*[local-name()='<Schema>']/*[local-name()='Root']/*[local-name()='Record']/*[local-name()='Tue']" />
<Link LinkID="47" LinkFrom="119" LinkTo="/*[local-name()='<Schema>']/*[local-name()='Root']/*[local-name()='Record']/*[local-name()='Wed']" />
<Link LinkID="48" LinkFrom="120" LinkTo="/*[local-name()='<Schema>']/*[local-name()='Root']/*[local-name()='Record']/*[local-name()='Thurs']" />
<Link LinkID="49" LinkFrom="121" LinkTo="/*[local-name()='<Schema>']/*[local-name()='Root']/*[local-name()='Record']/*[local-name()='Friday']" />
<Link LinkID="50" LinkFrom="122" LinkTo="/*[local-name()='<Schema>']/*[local-name()='Root']/*[local-name()='Record']/*[local-name()='Sat']" />
</Links>
<Functoids>
<Functoid FunctoidID="107" Functoid-FID="260" X-Cell="52" Y-Cell="194">
<Input-Parameters>
<Parameter Type="link" Value="22" linkIndex="0" Guid="7470c0bc-c75c-4ab5-99f2-250d7fe1e389" />
</Input-Parameters>
<ScripterCode>
<Script Language="CSharp">
<![CDATA[///*Uncomment the following code for a sample Inline C# function
//that concatenates two inputs. Change the number of parameters of
//this function to be equal to the number of inputs connected to this functoid.*/
public string dow(string myDate)
{
return DateTime.Parse(myDate).DayOfWeek.ToString();
}
]]>
</Script>
</ScripterCode>
</Functoid>
<Functoid FunctoidID="106" Functoid-FID="375" X-Cell="56" Y-Cell="193">
<Input-Parameters>
<Parameter Type="link" Value="18" linkIndex="0" Guid="87396644-e663-4615-9e42-67060259fb1a" />
<Parameter Type="link" Value="19" linkIndex="1" Guid="cc39c66f-59fd-427d-aefc-5c1195e6a72f" />
</Input-Parameters>
</Functoid>
<Functoid FunctoidID="105" Functoid-FID="375" X-Cell="56" Y-Cell="191">
<Input-Parameters>
<Parameter Type="link" Value="13" linkIndex="0" Guid="691fde94-db0b-4f53-b2ee-ff8f8f980027" />
<Parameter Type="link" Value="16" linkIndex="1" Guid="04844567-8d00-44cd-9b90-89e5009c4269" />
</Input-Parameters>
</Functoid>
<Functoid FunctoidID="104" Functoid-FID="375" X-Cell="56" Y-Cell="189">
<Input-Parameters>
<Parameter Type="link" Value="12" linkIndex="0" Guid="16e52083-f9c4-4563-980c-146f4621dab6" />
<Parameter Type="link" Value="14" linkIndex="1" Guid="58d9d487-43be-4e7a-a0b0-efbbae08d004" />
</Input-Parameters>
</Functoid>
<Functoid FunctoidID="103" Functoid-FID="375" X-Cell="56" Y-Cell="187">
<Input-Parameters>
<Parameter Type="link" Value="9" linkIndex="0" Guid="230f2ff4-b9aa-4903-893b-90bd3fe49540" />
<Parameter Type="link" Value="10" linkIndex="1" Guid="5cc1c29a-7398-4005-ace7-4cbc4c176960" />
</Input-Parameters>
</Functoid>
<Functoid FunctoidID="102" Functoid-FID="705" X-Cell="54" Y-Cell="186">
<Input-Parameters>
<Parameter Type="link" Value="8" linkIndex="0" Guid="b3777b48-0d39-499c-96c9-40ffdd0c8737" />
</Input-Parameters>
</Functoid>
<Functoid FunctoidID="98" Functoid-FID="260" X-Cell="52" Y-Cell="182">
<Input-Parameters />
<ScripterCode>
<Script Language="CSharp">
<![CDATA[// declare global variables for Voucher number assignment
System.Collections.Generic.List<string> keyList =
new System.Collections.Generic.List<string>();
public void init(){}
]]>
</Script>
</ScripterCode>
</Functoid>
<Functoid FunctoidID="101" Functoid-FID="315" X-Cell="54" Y-Cell="184">
<Input-Parameters>
<Parameter Type="link" Value="6" linkIndex="0" Guid="4a5c621f-9f4f-4b1f-a81b-6dce03aa402a" />
<Parameter Type="constant" Value="true" linkIndex="1" Guid="5aafc712-0e6c-44be-baf8-c3a7d8806eb5" />
</Input-Parameters>
</Functoid>
<Functoid FunctoidID="99" Functoid-FID="260" X-Cell="52" Y-Cell="184">
<Input-Parameters>
<Parameter Type="link" Value="5" linkIndex="0" Guid="bb64de45-0250-4d51-8ee3-4759d7812160" />
</Input-Parameters>
<ScripterCode>
<Script Language="CSharp">
<![CDATA[// Add invoice number to list if it doesn't already exist.
// increment voucher number if new invoice
public Boolean AddKeyToList(string key)
{
// if the Invoice number is not already in the List
if (!keyList.Contains(key))
{
// Add to list
keyList.Add(key);
return true;
}
return false;
}]]>
</Script>
</ScripterCode>
</Functoid>
<Functoid FunctoidID="100" Functoid-FID="107" X-Cell="44" Y-Cell="175">
<Input-Parameters>
<Parameter Type="link" Value="21" linkIndex="0" Guid="f630c6c2-b5c2-4c77-bf53-d25fdfb06b78" />
<Parameter Type="link" Value="3" linkIndex="1" Guid="f24d57bc-22d9-4390-bdf1-52ca16f9b45b" />
<Parameter Type="link" Value="4" linkIndex="2" Guid="87ee7e4f-374c-4343-aa68-0a5bf6fffac7" />
</Input-Parameters>
</Functoid>
<Functoid FunctoidID="117" Functoid-FID="375" X-Cell="56" Y-Cell="195">
<Input-Parameters>
<Parameter Type="link" Value="31" linkIndex="0" Guid="4e5e0ad8-543e-4a41-b702-74d2d8356030" />
<Parameter Type="link" Value="38" linkIndex="1" Guid="c94e83a7-1220-4797-ac03-751e089e9a07" />
</Input-Parameters>
</Functoid>
<Functoid FunctoidID="109" Functoid-FID="315" X-Cell="54" Y-Cell="195">
<Input-Parameters>
<Parameter Type="link" Value="24" linkIndex="0" Guid="c6998772-def3-4a8a-ae7d-0cdb947f95a4" />
<Parameter Type="constant" Value="Monday" linkIndex="1" Guid="64603dba-6df1-4b59-8968-62949ccc6759" />
</Input-Parameters>
</Functoid>
<Functoid FunctoidID="108" Functoid-FID="315" X-Cell="54" Y-Cell="194">
<Input-Parameters>
<Parameter Type="link" Value="23" linkIndex="0" Guid="d44d97ba-b3d3-48cd-a3c9-7ce4726d35df" />
<Parameter Type="constant" Value="Sunday" linkIndex="1" Guid="75cf8619-0493-4aac-9f76-1a020d7fac0f" />
</Input-Parameters>
</Functoid>
<Functoid FunctoidID="116" Functoid-FID="375" X-Cell="56" Y-Cell="194">
<Input-Parameters>
<Parameter Type="link" Value="30" linkIndex="0" Guid="c37bfe5c-9a5a-4b23-b300-16c942ba785b" />
<Parameter Type="link" Value="37" linkIndex="1" Guid="b02aab3d-6437-401c-9b06-bdf7c7d9c832" />
</Input-Parameters>
</Functoid>
<Functoid FunctoidID="110" Functoid-FID="315" X-Cell="54" Y-Cell="197">
<Input-Parameters>
<Parameter Type="link" Value="26" linkIndex="0" Guid="1cd88b45-1667-416e-aeef-78cc599f3cc7" />
<Parameter Type="constant" Value="Wednesday" linkIndex="1" Guid="773c8e04-45a2-4d1e-983f-0b53745c038f" />
</Input-Parameters>
</Functoid>
<Functoid FunctoidID="112" Functoid-FID="315" X-Cell="54" Y-Cell="196">
<Input-Parameters>
<Parameter Type="link" Value="25" linkIndex="0" Guid="599dfe5a-202b-49ee-a439-1276296501bd" />
<Parameter Type="constant" Value="Tuesday" linkIndex="1" Guid="bd4a7be3-b886-4cad-ab71-077b9cb507e0" />
</Input-Parameters>
</Functoid>
<Functoid FunctoidID="113" Functoid-FID="315" X-Cell="54" Y-Cell="198">
<Input-Parameters>
<Parameter Type="link" Value="27" linkIndex="0" Guid="61d375df-85ad-49ef-8161-5c7908e7a1f9" />
<Parameter Type="constant" Value="Thursday" linkIndex="1" Guid="efb2d4af-52e1-41c3-8886-e8acbcf6f788" />
</Input-Parameters>
</Functoid>
<Functoid FunctoidID="114" Functoid-FID="315" X-Cell="54" Y-Cell="199">
<Input-Parameters>
<Parameter Type="link" Value="28" linkIndex="0" Guid="84dc8167-ef26-41e2-8cbc-92bc09d9b513" />
<Parameter Type="constant" Value="Friday" linkIndex="1" Guid="bdea9f04-4e4d-458a-bc6c-5a7d063a9128" />
</Input-Parameters>
</Functoid>
<Functoid FunctoidID="115" Functoid-FID="315" X-Cell="54" Y-Cell="200">
<Input-Parameters>
<Parameter Type="link" Value="29" linkIndex="0" Guid="ad77c87e-b292-4b10-9932-7fc9f5981869" />
<Parameter Type="constant" Value="Saturday" linkIndex="1" Guid="d811f065-8eed-4445-9356-fe5327b2c634" />
</Input-Parameters>
</Functoid>
<Functoid FunctoidID="118" Functoid-FID="375" X-Cell="56" Y-Cell="196">
<Input-Parameters>
<Parameter Type="link" Value="32" linkIndex="0" Guid="32cd8143-b582-4d49-a048-84e54cd42bea" />
<Parameter Type="link" Value="39" linkIndex="1" Guid="95fffee4-6451-442d-9a60-19a297388aa5" />
</Input-Parameters>
</Functoid>
<Functoid FunctoidID="119" Functoid-FID="375" X-Cell="56" Y-Cell="197">
<Input-Parameters>
<Parameter Type="link" Value="33" linkIndex="0" Guid="d222802d-a84e-4cdd-8920-48623705506d" />
<Parameter Type="link" Value="40" linkIndex="1" Guid="9be3005a-d0e2-454d-b970-a350becadf5d" />
</Input-Parameters>
</Functoid>
<Functoid FunctoidID="120" Functoid-FID="375" X-Cell="56" Y-Cell="198">
<Input-Parameters>
<Parameter Type="link" Value="34" linkIndex="0" Guid="bfe3b4b6-c52a-4762-9c2c-b868d7f203fd" />
<Parameter Type="link" Value="41" linkIndex="1" Guid="f7eed5ef-5156-4d4b-8cc9-42a5c5773ec2" />
</Input-Parameters>
</Functoid>
<Functoid FunctoidID="121" Functoid-FID="375" X-Cell="56" Y-Cell="199">
<Input-Parameters>
<Parameter Type="link" Value="35" linkIndex="0" Guid="d2765ea5-a23c-43f5-834e-ec5e610f1114" />
<Parameter Type="link" Value="42" linkIndex="1" Guid="ccf811b9-31bc-4cb2-9d00-fa784c357575" />
</Input-Parameters>
</Functoid>
<Functoid FunctoidID="122" Functoid-FID="375" X-Cell="56" Y-Cell="200">
<Input-Parameters>
<Parameter Type="link" Value="36" linkIndex="0" Guid="63f4d89b-0487-434a-97a7-137b70376867" />
<Parameter Type="link" Value="43" linkIndex="1" Guid="2f302981-121d-4825-8251-6b9bd0123278" />
</Input-Parameters>
</Functoid>
</Functoids>
</Page>
</Pages>
</mapsource>
in the generated xsl, replace the <Root> element with:
<ns0:Root>
<xsl:for-each select="Record">
<xsl:variable name="var:v1" select="userCSharp:StringConcat(string(Company/text()) , string(Route/text()) , string(Prod/text()))" />
<xsl:variable name="var:v6" select="string(Company/text())" />
<xsl:variable name="var:v7" select="string(Route/text())" />
<xsl:variable name="var:v8" select="string(Prod/text())" />
<xsl:variable name="var:v9" select="userCSharp:StringConcat($var:v6 , $var:v7 , $var:v8)" />
<xsl:variable name="var:v25" select="string(Date/text())" />
<!-- Only create a new record node in the destibation if the Keys are different! -->
<xsl:variable name="varCurrentCompany" select="string(Company/text())" />
<xsl:variable name="varPrevCompany" select="string(preceding-sibling::Record[1]/Company/text())" />
<xsl:variable name="varCurrentRoute" select="string(Route/text())" />
<xsl:variable name="varPrevRoute" select="string(preceding-sibling::Record[1]/Route/text())" />
<xsl:variable name="varCurrentProd" select="string(Prod/text())" />
<xsl:variable name="varPrevProd" select="string(preceding-sibling::Record[1]/Prod/text())" />
<!-- do this by checking if the current record is different to the previous record -->
<xsl:if test="($varCurrentCompany!=$varPrevCompany) or ($varCurrentRoute!=$varPrevRoute) or ($varCurrentProd!=$varPrevProd)">
<Record>
<xsl:variable name="var:v2" select="userCSharp:AddKeyToList(string($var:v1))" />
<xsl:variable name="var:v3" select="userCSharp:LogicalEq(string($var:v2) , "true")" />
<xsl:variable name="var:v4" select="userCSharp:LogicalNot(string($var:v3))" />
<xsl:if test="string($var:v4)='true'">
<xsl:variable name="var:v5" select="Location/text()" />
<Loc>
<xsl:value-of select="$var:v5" />
</Loc>
</xsl:if>
<xsl:variable name="var:v10" select="userCSharp:AddKeyToList(string($var:v9))" />
<xsl:variable name="var:v11" select="userCSharp:LogicalEq(string($var:v10) , "true")" />
<xsl:variable name="var:v12" select="userCSharp:LogicalNot(string($var:v11))" />
<xsl:if test="string($var:v12)='true'">
<xsl:variable name="var:v13" select="Route/text()" />
<Route>
<xsl:value-of select="$var:v13" />
</Route>
</xsl:if>
<xsl:variable name="var:v14" select="userCSharp:AddKeyToList(string($var:v9))" />
<xsl:variable name="var:v15" select="userCSharp:LogicalEq(string($var:v14) , "true")" />
<xsl:variable name="var:v16" select="userCSharp:LogicalNot(string($var:v15))" />
<xsl:if test="string($var:v16)='true'">
<xsl:variable name="var:v17" select="Prod/text()" />
<Pr>
<xsl:value-of select="$var:v17" />
</Pr>
</xsl:if>
<xsl:variable name="var:v18" select="userCSharp:AddKeyToList(string($var:v9))" />
<xsl:variable name="var:v19" select="userCSharp:LogicalEq(string($var:v18) , "true")" />
<xsl:variable name="var:v20" select="userCSharp:LogicalNot(string($var:v19))" />
<xsl:if test="string($var:v20)='true'">
<xsl:variable name="var:v21" select="Company/text()" />
<Company>
<xsl:value-of select="$var:v21" />
</Company>
</xsl:if>
</Record>
</xsl:if>
<xsl:variable name="var:v22" select="userCSharp:dow(string(Date/text()))" />
<xsl:variable name="var:v23" select="userCSharp:LogicalEq(string($var:v22) , "Sunday")" />
<xsl:if test="string($var:v23)='true'">
<xsl:variable name="var:v24" select="Amount/text()" />
<Sun>
<xsl:value-of select="$var:v24" />
</Sun>
</xsl:if>
<xsl:variable name="var:v26" select="userCSharp:dow($var:v25)" />
<xsl:variable name="var:v27" select="userCSharp:LogicalEq(string($var:v26) , "Monday")" />
<xsl:if test="string($var:v27)='true'">
<xsl:variable name="var:v28" select="Amount/text()" />
<Mon>
<xsl:value-of select="$var:v28" />
</Mon>
</xsl:if>
<xsl:variable name="var:v29" select="userCSharp:dow($var:v25)" />
<xsl:variable name="var:v30" select="userCSharp:LogicalEq(string($var:v29) , "Tuesday")" />
<xsl:if test="string($var:v30)='true'">
<xsl:variable name="var:v31" select="Amount/text()" />
<Tue>
<xsl:value-of select="$var:v31" />
</Tue>
</xsl:if>
<xsl:variable name="var:v32" select="userCSharp:dow($var:v25)" />
<xsl:variable name="var:v33" select="userCSharp:LogicalEq(string($var:v32) , "Wednesday")" />
<xsl:if test="string($var:v33)='true'">
<xsl:variable name="var:v34" select="Amount/text()" />
<Wed>
<xsl:value-of select="$var:v34" />
</Wed>
</xsl:if>
<xsl:variable name="var:v35" select="userCSharp:dow($var:v25)" />
<xsl:variable name="var:v36" select="userCSharp:LogicalEq(string($var:v35) , "Thursday")" />
<xsl:if test="string($var:v36)='true'">
<xsl:variable name="var:v37" select="Amount/text()" />
<Thurs>
<xsl:value-of select="$var:v37" />
</Thurs>
</xsl:if>
<xsl:variable name="var:v38" select="userCSharp:dow($var:v25)" />
<xsl:variable name="var:v39" select="userCSharp:LogicalEq(string($var:v38) , "Friday")" />
<xsl:if test="string($var:v39)='true'">
<xsl:variable name="var:v40" select="Amount/text()" />
<Friday>
<xsl:value-of select="$var:v40" />
</Friday>
</xsl:if>
<xsl:variable name="var:v41" select="userCSharp:dow($var:v25)" />
<xsl:variable name="var:v42" select="userCSharp:LogicalEq(string($var:v41) , "Saturday")" />
<xsl:if test="string($var:v42)='true'">
<xsl:variable name="var:v43" select="Amount/text()" />
<Sat>
<xsl:value-of select="$var:v43" />
</Sat>
</xsl:if>
</xsl:for-each>
<xsl:variable name="var:v44" select="userCSharp:init()" />
<xsl:value-of select="$var:v44" />
</ns0:Root>

Resources