<?xml version="1.0" encoding="UTF-8"?>
<structure version="17" html-doctype="HTML4 Transitional" compatibility-view="IE9" html-outputextent="Complete" relativeto="*SPS" encodinghtml="UTF-8" encodingrtf="ISO-8859-1" encodingpdf="UTF-8" useimportschema="1" embed-images="1" enable-authentic-scripts="1" authentic-scripts-in-debug-mode-external="0" generated-file-location="DEFAULT">
	<parameters/>
	<schemasources>
		<namespaces/>
		<schemasources>
			<xsdschemasource name="Order" main="1" schemafile="MergeOrder.xsd" workingxmlfile="MergeOrder.xml"/>
			<xsdschemasource name="Articles" schemafile="MergeArticles.xsd" workingxmlfile="MergeArticles.xml"/>
		</schemasources>
	</schemasources>
	<modules/>
	<flags>
		<scripts/>
		<mainparts/>
		<globalparts/>
		<designfragments/>
		<pagelayouts/>
		<xpath-functions/>
	</flags>
	<scripts>
		<script language="javascript"/>
	</scripts>
	<script-project>
		<Project version="3" app="AuthenticView"/>
	</script-project>
	<importedxslt/>
	<globalstyles>
		<rule url="Samples.css">
			<media>
				<media value="all"/>
			</media>
		</rule>
		<rules selector="th">
			<media>
				<media value="all"/>
			</media>
			<rule font-weight="normal"/>
		</rules>
	</globalstyles>
	<mainparts>
		<children>
			<globaltemplate subtype="main" match="/">
				<document-properties/>
				<children>
					<documentsection>
						<properties columncount="1" columngap="0.50in" headerfooterheight="fixed" pagemultiplepages="0" pagenumberingformat="1" pagenumberingstartat="auto" pagestart="next" paperheight="11in" papermarginbottom="0.79in" papermarginfooter="0.30in" papermarginheader="0.30in" papermarginleft="0.60in" papermarginright="0.60in" papermargintop="0.79in" paperwidth="8.50in"/>
						<watermark>
							<image transparency="50" fill-page="1" center-if-not-fill="1"/>
							<text transparency="50"/>
						</watermark>
					</documentsection>
					<paragraph paragraphtag="p">
						<properties class="info"/>
						<children>
							<text fixtext="This examples demonstrate how to merge data from different XML files in a single report."/>
						</children>
					</paragraph>
					<paragraph paragraphtag="p">
						<properties class="explanation"/>
						<children>
							<text fixtext="Please note that this sample contains two sources: one is $Order which gets data from MergeOrder.xml and another one is $Articles with data from MergeArticles.xml"/>
						</children>
					</paragraph>
					<paragraph paragraphtag="p">
						<properties class="explanation"/>
						<children>
							<text fixtext="If you simply want to show data of every file independently, then everything is easy - simply drag &amp; drop corresponding nodes from Schema Tree."/>
						</children>
					</paragraph>
					<paragraph paragraphtag="p">
						<children>
							<text fixtext="Our huge jewelry store offers wide selection of articles:"/>
						</children>
					</paragraph>
					<template subtype="source" match="Articles">
						<children>
							<template subtype="element" match="Articles">
								<children>
									<template subtype="element" match="Article">
										<children>
											<paragraph>
												<children>
													<template subtype="attribute" match="PartNum">
														<children>
															<text fixtext="    "/>
															<content subtype="regular">
																<styles font-weight="bold"/>
															</content>
														</children>
														<variables/>
													</template>
													<template subtype="element" match="ProductName">
														<children>
															<text fixtext="    "/>
															<content subtype="regular">
																<styles font-weight="bold"/>
															</content>
														</children>
														<variables/>
													</template>
												</children>
											</paragraph>
										</children>
										<variables/>
									</template>
								</children>
								<variables/>
							</template>
						</children>
						<variables/>
					</template>
					<paragraph paragraphtag="p">
						<children>
							<text fixtext="Your current selection includes articles with the following part numbers:"/>
						</children>
					</paragraph>
					<template subtype="source" match="Order">
						<children>
							<template subtype="element" match="Order">
								<children>
									<template subtype="element" match="Item">
										<children>
											<paragraph>
												<children>
													<template subtype="attribute" match="partNum">
														<children>
															<text fixtext="    "/>
															<content subtype="regular">
																<styles font-weight="bold"/>
															</content>
														</children>
														<variables/>
													</template>
												</children>
											</paragraph>
										</children>
										<variables/>
									</template>
								</children>
								<variables/>
							</template>
						</children>
						<variables/>
					</template>
					<paragraph paragraphtag="p">
						<properties class="explanation"/>
						<children>
							<text fixtext="Now let us see how to combine data together."/>
						</children>
					</paragraph>
					<paragraph paragraphtag="p">
						<properties class="explanation"/>
						<children>
							<text fixtext="The solution is to list all orders and inject data from $Articles source wherever necessary. To find matching article data we use a user-defined template, which compares part numbers: $Articles//Article[@PartNum=current()/@partNum]"/>
						</children>
					</paragraph>
					<paragraph paragraphtag="p">
						<properties class="explanation"/>
						<children>
							<text fixtext="Note use of the function current(). It delivers the currently selected context node. We are searching for Articles within Order Item node, which is what current() returns."/>
						</children>
					</paragraph>
					<paragraph paragraphtag="p">
						<children>
							<text fixtext="You have ordered:"/>
						</children>
					</paragraph>
					<template subtype="source" match="Order">
						<children>
							<template subtype="element" match="Order">
								<children>
									<template subtype="element" match="Item">
										<children>
											<paragraph>
												<children>
													<template subtype="attribute" match="quantity">
														<children>
															<text fixtext="    "/>
															<content subtype="regular">
																<styles font-weight="bold"/>
																<format basic-type="xsd" datatype="short"/>
															</content>
														</children>
														<variables/>
													</template>
													<text fixtext=" "/>
													<template subtype="userdefined" match="$Articles//Article[@PartNum=current()/@partNum]">
														<children>
															<template subtype="element" match="ProductName">
																<children>
																	<content subtype="regular">
																		<styles font-weight="bold"/>
																	</content>
																</children>
																<variables/>
															</template>
															<text fixtext=" "/>
														</children>
														<variables/>
													</template>
												</children>
											</paragraph>
										</children>
										<variables/>
									</template>
								</children>
								<variables/>
							</template>
						</children>
						<variables/>
					</template>
					<newline break="page"/>
					<paragraph paragraphtag="p">
						<properties class="explanation"/>
						<children>
							<text fixtext="If we want to build a table with order information, it becomes apparent that we have to repeat our user-defined template for every column."/>
						</children>
					</paragraph>
					<paragraph paragraphtag="p">
						<children>
							<text fixtext="You have ordered:"/>
						</children>
					</paragraph>
					<template subtype="source" match="Order">
						<children>
							<template subtype="element" match="Order">
								<children>
									<tgrid>
										<children>
											<tgridbody-cols>
												<children>
													<tgridcol>
														<styles width="0.3in"/>
													</tgridcol>
													<tgridcol>
														<styles width="2in"/>
													</tgridcol>
													<tgridcol>
														<styles width="1in"/>
													</tgridcol>
												</children>
											</tgridbody-cols>
											<tgridheader-rows>
												<children>
													<tgridrow>
														<children>
															<tgridcell>
																<styles text-align="left"/>
															</tgridcell>
															<tgridcell>
																<styles text-align="left"/>
																<children>
																	<text fixtext="Name"/>
																</children>
															</tgridcell>
															<tgridcell>
																<styles text-align="left"/>
																<children>
																	<text fixtext="Unit price"/>
																</children>
															</tgridcell>
														</children>
													</tgridrow>
												</children>
											</tgridheader-rows>
											<tgridbody-rows>
												<children>
													<template subtype="element" match="Item">
														<children>
															<tgridrow>
																<styles font-weight="bold"/>
																<children>
																	<tgridcell>
																		<styles text-align="right"/>
																		<children>
																			<template subtype="attribute" match="quantity">
																				<children>
																					<content subtype="regular">
																						<format basic-type="xsd" datatype="short"/>
																					</content>
																				</children>
																				<variables/>
																			</template>
																		</children>
																	</tgridcell>
																	<tgridcell>
																		<children>
																			<template subtype="userdefined" match="$Articles//Article[@PartNum=current()/@partNum]">
																				<children>
																					<template subtype="element" match="ProductName">
																						<children>
																							<content subtype="regular"/>
																						</children>
																						<variables/>
																					</template>
																					<text fixtext=" "/>
																				</children>
																				<variables/>
																			</template>
																		</children>
																	</tgridcell>
																	<tgridcell>
																		<children>
																			<template subtype="userdefined" match="$Articles//Article[@PartNum=current()/@partNum]">
																				<children>
																					<template subtype="element" match="Price">
																						<children>
																							<content subtype="regular">
																								<format basic-type="xsd" datatype="decimal"/>
																							</content>
																						</children>
																						<variables/>
																					</template>
																					<text fixtext=" "/>
																				</children>
																				<variables/>
																			</template>
																		</children>
																	</tgridcell>
																</children>
															</tgridrow>
														</children>
														<variables/>
													</template>
												</children>
											</tgridbody-rows>
										</children>
									</tgrid>
								</children>
								<variables/>
							</template>
						</children>
						<variables/>
					</template>
					<paragraph paragraphtag="p">
						<properties class="explanation"/>
						<children>
							<text fixtext="We can avoid searching for a corresponding Article for every column. In order to save the result for further use we define a variable $ItemArticle by right-clicking Item template and using Define Variables menu. We then use this variable for every column."/>
						</children>
					</paragraph>
					<template subtype="source" match="Order">
						<children>
							<template subtype="element" match="Order">
								<children>
									<tgrid>
										<children>
											<tgridbody-cols>
												<children>
													<tgridcol>
														<styles width="0.3in"/>
													</tgridcol>
													<tgridcol>
														<styles width="2in"/>
													</tgridcol>
													<tgridcol>
														<styles width="1in"/>
													</tgridcol>
												</children>
											</tgridbody-cols>
											<tgridheader-rows>
												<children>
													<tgridrow>
														<children>
															<tgridcell>
																<styles text-align="left"/>
															</tgridcell>
															<tgridcell>
																<styles text-align="left"/>
																<children>
																	<text fixtext="Name"/>
																</children>
															</tgridcell>
															<tgridcell>
																<styles text-align="left"/>
																<children>
																	<text fixtext="Unit price"/>
																</children>
															</tgridcell>
														</children>
													</tgridrow>
												</children>
											</tgridheader-rows>
											<tgridbody-rows>
												<children>
													<template subtype="element" match="Item">
														<children>
															<tgridrow>
																<styles font-weight="bold"/>
																<children>
																	<tgridcell>
																		<styles text-align="right"/>
																		<children>
																			<template subtype="attribute" match="quantity">
																				<children>
																					<content subtype="regular">
																						<format basic-type="xsd" datatype="short"/>
																					</content>
																				</children>
																				<variables/>
																			</template>
																		</children>
																	</tgridcell>
																	<tgridcell>
																		<children>
																			<template subtype="uservariable" match="$ItemArticle">
																				<children>
																					<template subtype="element" match="ProductName">
																						<children>
																							<content subtype="regular"/>
																						</children>
																						<variables/>
																					</template>
																					<text fixtext=" "/>
																				</children>
																				<variables/>
																			</template>
																		</children>
																	</tgridcell>
																	<tgridcell>
																		<children>
																			<template subtype="uservariable" match="$ItemArticle">
																				<children>
																					<template subtype="element" match="Price">
																						<children>
																							<content subtype="regular">
																								<format basic-type="xsd" datatype="decimal"/>
																							</content>
																						</children>
																						<variables/>
																					</template>
																					<text fixtext=" "/>
																				</children>
																				<variables/>
																			</template>
																		</children>
																	</tgridcell>
																</children>
															</tgridrow>
														</children>
														<variables>
															<variable name="ItemArticle" value="$Articles//Article[@PartNum=current()/@partNum]" valuetype="&lt;auto&gt;"/>
														</variables>
													</template>
												</children>
											</tgridbody-rows>
										</children>
									</tgrid>
								</children>
								<variables/>
							</template>
						</children>
						<variables/>
					</template>
					<paragraph paragraphtag="p">
						<properties class="explanation"/>
						<children>
							<text fixtext="AutoCalc allows us to perform any desired calculations (Overall price) or to make design more compact, though less explicit (Unit price). Note that when calculating Overall price we can use both: current()/@quantity or simply @quantity. This is because the function current() is implicitly applied whenever possible. But within [] brackets (like in example above) it must be explicitly used."/>
						</children>
					</paragraph>
					<template subtype="source" match="Order">
						<children>
							<template subtype="element" match="Order">
								<children>
									<tgrid>
										<children>
											<tgridbody-cols>
												<children>
													<tgridcol>
														<styles width="0.3in"/>
													</tgridcol>
													<tgridcol>
														<styles width="2in"/>
													</tgridcol>
													<tgridcol>
														<styles width="1in"/>
													</tgridcol>
													<tgridcol>
														<styles width="1in"/>
													</tgridcol>
												</children>
											</tgridbody-cols>
											<tgridheader-rows>
												<children>
													<tgridrow>
														<children>
															<tgridcell>
																<styles text-align="left"/>
															</tgridcell>
															<tgridcell>
																<styles text-align="left"/>
																<children>
																	<text fixtext="Name"/>
																</children>
															</tgridcell>
															<tgridcell>
																<styles text-align="left"/>
																<children>
																	<text fixtext="Unit price"/>
																</children>
															</tgridcell>
															<tgridcell>
																<styles text-align="left"/>
																<children>
																	<text fixtext="Overall price"/>
																</children>
															</tgridcell>
														</children>
													</tgridrow>
												</children>
											</tgridheader-rows>
											<tgridbody-rows>
												<children>
													<template subtype="element" match="Item">
														<children>
															<tgridrow>
																<styles font-weight="bold"/>
																<children>
																	<tgridcell>
																		<styles text-align="right"/>
																		<children>
																			<template subtype="attribute" match="quantity">
																				<children>
																					<content subtype="regular">
																						<format basic-type="xsd" datatype="short"/>
																					</content>
																				</children>
																				<variables/>
																			</template>
																		</children>
																	</tgridcell>
																	<tgridcell>
																		<children>
																			<template subtype="uservariable" match="$ItemArticle">
																				<children>
																					<template subtype="element" match="ProductName">
																						<children>
																							<content subtype="regular"/>
																						</children>
																						<variables/>
																					</template>
																					<text fixtext=" "/>
																				</children>
																				<variables/>
																			</template>
																		</children>
																	</tgridcell>
																	<tgridcell>
																		<children>
																			<autocalc xpath="$ItemArticle/Price"/>
																		</children>
																	</tgridcell>
																	<tgridcell>
																		<children>
																			<autocalc xpath="@quantity * $ItemArticle/Price">
																				<format basic-type="xsd" string="#####0.00{dec=.}" datatype="decimal"/>
																			</autocalc>
																		</children>
																	</tgridcell>
																</children>
															</tgridrow>
														</children>
														<variables>
															<variable name="ItemArticle" value="$Articles//Article[@PartNum=current()/@partNum]" valuetype="&lt;auto&gt;"/>
														</variables>
													</template>
												</children>
											</tgridbody-rows>
										</children>
									</tgrid>
								</children>
								<variables/>
							</template>
						</children>
						<variables/>
					</template>
				</children>
			</globaltemplate>
		</children>
	</mainparts>
	<globalparts/>
	<designfragments/>
	<xmltables/>
	<authentic-custom-toolbar-buttons/>
</structure>
