<commit_before><?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template name="essentials">
	<fieldset class="settings">
		<legend>Essentials</legend>
		<div class="group">
			<div>
				<xsl:if test="/data/errors/name">
					<xsl:attribute name="class">
						<xsl:text>invalid</xsl:text>
					</xsl:attribute>
				</xsl:if>
				<label>
					<xsl:text>Name</xsl:text>
					<input type="text" name="fields[name]">
						<!--
							TODO add postback value
						-->
						<xsl:attribute name="value">
							<xsl:if test="/data/fields">
								<xsl:value-of select="/data/fields/name"/>
							</xsl:if>
							<xsl:if test="not(/data/fields) and /data/recipientgroups/entry/name">
								<xsl:value-of select="/data/recipientgroups/entry/name"/>
							</xsl:if>
						</xsl:attribute>
					</input>
				</label>
				<xsl:if test="/data/errors/name">
					<p><xsl:value-of select="/data/errors/name"/></p>
				</xsl:if>
			</div>
			<div>
				<label>
					<xsl:text>Source</xsl:text>
					<select id="context" name="fields[source]">
						<optgroup label="Sections">
							<xsl:for-each select="/data/sections/entry">
								<option value="{id}">
									<xsl:if test="/data/recipientgroups/entry/source = current()/id">
										<xsl:attribute name="selected">
											<xsl:text>yes</xsl:text>
										</xsl:attribute>
									</xsl:if>
									<xsl:value-of select="name"/>
								</option>
							</xsl:for-each>
						</optgroup>
						<optgroup label="System">
							<option value="authors">Authors</option>
						</optgroup>
						<optgroup label="Static">
							<option value="static_recipients">Static Recipients</option>
						</optgroup>
					</select>
				</label>
			</div>
		</div>
	</fieldset>
</xsl:template>

</xsl:stylesheet><commit_msg>Use POST value for name if available. Removed legacy `/data/fields'.<commit_after><?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template name="essentials">
	<fieldset class="settings">
		<legend>Essentials</legend>
		<div class="group">
			<div>
				<xsl:if test="/data/errors/name">
					<xsl:attribute name="class">
						<xsl:text>invalid</xsl:text>
					</xsl:attribute>
				</xsl:if>
				<label>
					<xsl:text>Name</xsl:text>
					<input type="text" name="fields[name]">
						<xsl:attribute name="value">
							<xsl:choose>
								<xsl:when test="/data/post-fields/name">
									<xsl:value-of select="/data/post-fields/name"/>
								</xsl:when>
								<xsl:otherwise>
									<xsl:value-of select="/data/recipientgroups/entry/name"/>
								</xsl:otherwise>
							</xsl:choose>
						</xsl:attribute>
					</input>
				</label>
				<xsl:if test="/data/errors/name">
					<p><xsl:value-of select="/data/errors/name"/></p>
				</xsl:if>
			</div>
			<div>
				<label>
					<xsl:text>Source</xsl:text>
					<select id="context" name="fields[source]">
						<optgroup label="Sections">
							<xsl:for-each select="/data/sections/entry">
								<option value="{id}">
									<xsl:if test="/data/recipientgroups/entry/source = current()/id">
										<xsl:attribute name="selected">
											<xsl:text>yes</xsl:text>
										</xsl:attribute>
									</xsl:if>
									<xsl:value-of select="name"/>
								</option>
							</xsl:for-each>
						</optgroup>
						<optgroup label="System">
							<option value="authors">Authors</option>
						</optgroup>
						<optgroup label="Static">
							<option value="static_recipients">Static Recipients</option>
						</optgroup>
					</select>
				</label>
			</div>
		</div>
	</fieldset>
</xsl:template>

</xsl:stylesheet>
{'fraction_non_alphanumeric': 0.19650067294751009, 'fraction_numerical': 0.005383580080753701, 'mean_word_length': 2.6792079207920794, 'pattern_counts': {'":': 0, '<': 140, '<?xml version=': 2, '>': 140, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3375485', 'n_tokens_mistral': 1873, 'n_tokens_neox': 1250, 'n_words': 195}