<?xml version="1.0" encoding="UTF-8"?>
<structure version="15" html-doctype="HTML4 Transitional" compatibility-view="IE9" relativeto="*SPS" encodinghtml="UTF-8" encodingrtf="ISO-8859-1" encodingpdf="UTF-8" useimportschema="1" embed-images="1" pastemode="xml" enable-authentic-scripts="1" authentic-scripts-in-debug-mode-external="0" generated-file-location="DEFAULT">
	<parameters/>
	<schemasources>
		<namespaces/>
		<schemasources>
			<xsdschemasource name="XML" main="1" schemafile="Data.xsd" workingxmlfile="Data.xml"/>
		</schemasources>
	</schemasources>
	<modules/>
	<flags>
		<scripts/>
		<mainparts/>
		<globalparts/>
		<designfragments/>
		<pagelayouts/>
		<xpath-functions/>
	</flags>
	<scripts>
		<script language="javascript"/>
	</scripts>
	<script-project>
		<Project version="2" app="AuthenticView"/>
	</script-project>
	<importedxslt/>
	<globalstyles>
		<rules selector=".info">
			<media>
				<media value="all"/>
			</media>
			<rule background-color="#f6f6ff" border="1px solid navy" color="navy" font-weight="bold" margin-bottom="12px" margin-top="12px" padding="2px"/>
		</rules>
		<rules selector=".explanation">
			<media>
				<media value="all"/>
			</media>
			<rule color="blue" font-style="italic" margin-bottom="12px"/>
		</rules>
	</globalstyles>
	<mainparts>
		<children>
			<globaltemplate subtype="main" match="/">
				<document-properties/>
				<children>
					<documentsection>
						<properties columncount="1" columngap="48px" headerfooterheight="variable" pagemultiplepages="0" pagenumberingformat="1" pagenumberingstartat="auto" pagestart="next" paperheight="11.69in" papermarginbottom="0.79in" papermarginfooter="0.5in" papermarginheader="0.5in" papermarginleft="0.6in" papermarginright="0.6in" papermargintop="0.79in" paperwidth="8.27in"/>
					</documentsection>
					<paragraph paragraphtag="h2">
						<styles border-bottom="2px solid navy" color="navy"/>
						<children>
							<text fixtext="Example: Templates - grouping"/>
						</children>
					</paragraph>
					<paragraph paragraphtag="p">
						<properties class="info"/>
						<children>
							<text fixtext="This example demonstrates how you can have StyleVision generate XSLT code to group the entries that are iterated over with a template, according to some criterion. Note that grouping only works in XSLT 2.0, and is not applied in Authentic."/>
						</children>
					</paragraph>
					<template subtype="source" match="XML">
						<children>
							<template subtype="element" match="data">
								<children>
									<template subtype="element" match="strings">
										<children>
											<paragraph paragraphtag="p">
												<properties class="explanation"/>
												<children>
													<text fixtext="For reference, all entries of the &apos;string&apos; element, as they appear in the XML:"/>
												</children>
											</paragraph>
											<template subtype="element" match="string">
												<children>
													<content>
														<format basic-type="xsd" datatype="string"/>
													</content>
													<newline/>
												</children>
												<variables/>
											</template>
											<newline/>
											<paragraph paragraphtag="p">
												<properties class="explanation"/>
												<children>
													<text fixtext="Below we list the same strings, but grouped in various ways. To see how the grouping is defined, right click on the template markup and choose &quot;Group by...&quot; from the context menu."/>
												</children>
											</paragraph>
											<paragraph paragraphtag="p">
												<properties class="explanation"/>
												<children>
													<text fixtext="When defining a grouping, you use 2 templates: The outer template that defines the grouping iterates over all resulting "/>
													<text fixtext="groups">
														<styles font-weight="bold"/>
													</text>
													<text fixtext=". Furthermore, you (normally) use a nested &apos;current-group()&apos; template that iterates over all "/>
													<text fixtext="entries">
														<styles font-weight="bold"/>
													</text>
													<text fixtext=" in a given group (per definition every group has at least 1 entry)."/>
												</children>
											</paragraph>
											<paragraph paragraphtag="p">
												<properties class="explanation"/>
												<children>
													<text fixtext="1.) &quot;group-by&quot; example: group event and odd entries, respectively"/>
												</children>
											</paragraph>
											<template subtype="element" groupingtype="group-by" groupingmatch="position() mod 2" match="string">
												<children>
													<template subtype="userdefined" match="current-group()">
														<children>
															<content>
																<format basic-type="xsd" datatype="string"/>
															</content>
															<newline/>
														</children>
														<variables/>
													</template>
													<newline/>
												</children>
												<variables/>
											</template>
											<paragraph paragraphtag="p">
												<properties class="explanation"/>
												<children>
													<text fixtext="2.) &quot;group-adjacent&quot; example: group according to starting character"/>
												</children>
											</paragraph>
											<template subtype="element" groupingtype="group-adjacent" groupingmatch="substring( . , 1, 1 )" match="string">
												<children>
													<template subtype="userdefined" match="current-group()">
														<children>
															<content>
																<format basic-type="xsd" datatype="string"/>
															</content>
															<newline/>
														</children>
														<variables/>
													</template>
													<newline/>
												</children>
												<variables/>
											</template>
											<paragraph paragraphtag="p">
												<properties class="explanation"/>
												<children>
													<text fixtext="3.) &quot;group-starting-with&quot; example: start a new group with the 2nd entry (note that with this option the XPath expression must be a "/>
													<text fixtext="pattern">
														<styles font-weight="bold"/>
													</text>
													<text fixtext=". A new group is started if the examined node matches that pattern.)"/>
												</children>
											</paragraph>
											<template subtype="element" groupingtype="group-starting-with" groupingmatch="string[2]" match="string">
												<children>
													<template subtype="userdefined" match="current-group()">
														<children>
															<content>
																<format basic-type="xsd" datatype="string"/>
															</content>
															<newline/>
														</children>
														<variables/>
													</template>
													<newline/>
												</children>
												<variables/>
											</template>
											<paragraph paragraphtag="p">
												<properties class="explanation"/>
												<children>
													<text fixtext="4.) &quot;group-ending-with&quot; example: end a group with the 3rd entry (note that with this option the XPath expression must be a "/>
													<text fixtext="pattern">
														<styles font-weight="bold"/>
													</text>
													<text fixtext=". The current group is ended if the examined node matches that pattern.)"/>
												</children>
											</paragraph>
											<template subtype="element" groupingtype="group-ending-with" groupingmatch="string[3]" match="string">
												<children>
													<template subtype="userdefined" match="current-group()">
														<children>
															<content>
																<format basic-type="xsd" datatype="string"/>
															</content>
															<newline/>
														</children>
														<variables/>
													</template>
													<newline/>
												</children>
												<variables/>
											</template>
											<newline/>
											<paragraph paragraphtag="p">
												<properties class="explanation"/>
												<children>
													<text fixtext="Finally, you can apply sorting to both the grouping template and the &apos;current-group()&apos; template individually, to sort in which order the groups are being generated and/or in which order the entries in every group are generated. For this (and other purposes), XSLT defines the context item of a group as the first entry in that group."/>
												</children>
											</paragraph>
											<paragraph paragraphtag="p">
												<properties class="explanation"/>
												<children>
													<text fixtext="We modify the 2nd example to sort the groups according to the number of entries, and sort the entries of every group alphabetically."/>
												</children>
											</paragraph>
											<template subtype="element" groupingtype="group-adjacent" groupingmatch="substring( . , 1, 1 )" match="string">
												<sort>
													<key match="count(  current-group() )"/>
												</sort>
												<children>
													<template subtype="userdefined" match="current-group()">
														<sort>
															<key match="."/>
														</sort>
														<children>
															<content>
																<format basic-type="xsd" datatype="string"/>
															</content>
															<newline/>
														</children>
														<variables/>
													</template>
													<newline/>
												</children>
												<variables/>
											</template>
											<line/>
										</children>
										<variables/>
									</template>
								</children>
								<variables/>
							</template>
						</children>
						<variables/>
					</template>
				</children>
			</globaltemplate>
		</children>
	</mainparts>
	<globalparts/>
	<designfragments/>
	<xmltables/>
	<authentic-custom-toolbar-buttons/>
</structure>
