X-Git-Url: https://git.ladys.computer/LesML/blobdiff_plain/440eeff8f1b198dc3028fd4573a0ce871a86fa52..889242706f6a51e5edcc3d515280200b754c078d:/parser.xslt?ds=inline

diff --git a/parser.xslt b/parser.xslt
index a47b5bb..8772693 100644
--- a/parser.xslt
+++ b/parser.xslt
@@ -15,6 +15,7 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
 	<!ENTITY section-break "*-.=_~·․‥…⁂⋯─━┄┅┈┉╌╍═╴╶╸╺☙❧ ・*-.=_~">
 	<!ENTITY sigiled-text "(string-length($text)=1 or substring($text, 2, 1)=' ')">
 	<!ENTITY unsigiled-text "substring($text, 3, string-length($text)-2)">
+	<!ENTITY xhtml "http://www.w3.org/1999/xhtml">
 ]>
 <transform
 	xmlns="http://www.w3.org/1999/XSL/Transform"
@@ -62,7 +63,7 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
 				<with-param name="source" select="string()"/>
 			</call-template>
 			<if test="position()!=count($broken)">
-				<element name="html:br"/>
+				<element name="br" namespace="&xhtml;"/>
 			</if>
 		</for-each>
 	</template>
@@ -219,7 +220,7 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
 		</if>
 		<if test="$shebang!='' or $doclines[normalize-space()!='']">
 			<variable name="record-separators" select="$doclines[starts-with(., '%%')]"/>
-			<element name="html:article">
+			<element name="article" namespace="&xhtml;">
 				<for-each select="$params/html:div/html:dt[string()=' LANG ']">
 					<attribute name="lang">
 						<value-of select="following-sibling::html:dd"/>
@@ -234,7 +235,7 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
 					</attribute>
 				</for-each>
 				<if test="$record-separators[preceding-sibling::*[normalize-space()!='']]">
-					<element name="html:footer">
+					<element name="footer" namespace="&xhtml;">
 						<attribute name="class">
 							<text>head</text>
 						</attribute>
@@ -243,17 +244,17 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
 							<variable name="prev-separator" select="$record-separators[($position)-1]"/>
 							<variable name="fields" select="$noshebang[following-sibling::*[generate-id()=generate-id(current())] and (not($prev-separator) or preceding-sibling::*[generate-id()=generate-id($prev-separator)])]"/>
 							<if test="$fields">
-								<element name="html:dl">
+								<element name="dl" namespace="&xhtml;">
 									<for-each select="$fields">
 										<choose>
 											<when test="starts-with(., ' ') and $fields[generate-id()=generate-id(current()/preceding-sibling::*[1])]"/>
 											<otherwise>
 												<variable name="next" select="following-sibling::*[not(starts-with(., ' '))]"/>
-												<element name="html:div">
-													<element name="html:dt">
+												<element name="div" namespace="&xhtml;">
+													<element name="dt" namespace="&xhtml;">
 														<value-of select="normalize-space(substring-before(., ':'))"/>
 													</element>
-													<element name="html:dd">
+													<element name="dd" namespace="&xhtml;">
 														<variable name="firstline">
 															<choose>
 																<when test="contains(., ':')">
@@ -298,7 +299,7 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
 						</for-each>
 					</element>
 				</if>
-				<element name="html:div">
+				<element name="div" namespace="&xhtml;">
 					<attribute name="class">
 						<text>body</text>
 					</attribute>
@@ -351,49 +352,49 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
 					<variable name="par">
 						<choose>
 							<when test="$preformatted">
-								<element name="html:pre">
+								<element name="pre" namespace="&xhtml;">
 									<call-template name="LesML:id-and-contents">
 										<with-param name="source" select="$text"/>
 									</call-template>
 								</element>
 							</when>
 							<when test="starts-with($text, '⁌') and &sigiled-text;">
-								<element name="html:h1">
+								<element name="h1" namespace="&xhtml;">
 									<call-template name="LesML:id-and-contents">
 										<with-param name="source" select="&unsigiled-text;"/>
 									</call-template>
 								</element>
 							</when>
 							<when test="starts-with($text, '§') and &sigiled-text;">
-								<element name="html:h2">
+								<element name="h2" namespace="&xhtml;">
 									<call-template name="LesML:id-and-contents">
 										<with-param name="source" select="&unsigiled-text;"/>
 									</call-template>
 								</element>
 							</when>
 							<when test="starts-with($text, '❦') and &sigiled-text;">
-								<element name="html:h3">
+								<element name="h3" namespace="&xhtml;">
 									<call-template name="LesML:id-and-contents">
 										<with-param name="source" select="&unsigiled-text;"/>
 									</call-template>
 								</element>
 							</when>
 							<when test="starts-with($text, '✠') and &sigiled-text;">
-								<element name="html:h4">
+								<element name="h4" namespace="&xhtml;">
 									<call-template name="LesML:id-and-contents">
 										<with-param name="source" select="&unsigiled-text;"/>
 									</call-template>
 								</element>
 							</when>
 							<when test="starts-with($text, '•') and &sigiled-text;">
-								<element name="html:li">
+								<element name="li" namespace="&xhtml;">
 									<attribute name="class">
 										<text>unordered</text>
 									</attribute>
 									<attribute name="data-level">
 										<text>1</text>
 									</attribute>
-									<element name="html:p">
+									<element name="p" namespace="&xhtml;">
 										<call-template name="LesML:id-and-contents">
 											<with-param name="source" select="&unsigiled-text;"/>
 										</call-template>
@@ -401,14 +402,14 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
 								</element>
 							</when>
 							<when test="starts-with($text, '🔢') and &sigiled-text;">
-								<element name="html:li">
+								<element name="li" namespace="&xhtml;">
 									<attribute name="class">
 										<text>ordered</text>
 									</attribute>
 									<attribute name="data-level">
 										<text>1</text>
 									</attribute>
-									<element name="html:p">
+									<element name="p" namespace="&xhtml;">
 										<call-template name="LesML:id-and-contents">
 											<with-param name="source" select="&unsigiled-text;"/>
 										</call-template>
@@ -416,14 +417,14 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
 								</element>
 							</when>
 							<when test="starts-with($text, '◦') and &sigiled-text;">
-								<element name="html:li">
+								<element name="li" namespace="&xhtml;">
 									<attribute name="class">
 										<text>unordered</text>
 									</attribute>
 									<attribute name="data-level">
 										<text>2</text>
 									</attribute>
-									<element name="html:p">
+									<element name="p" namespace="&xhtml;">
 										<call-template name="LesML:id-and-contents">
 											<with-param name="source" select="&unsigiled-text;"/>
 										</call-template>
@@ -431,14 +432,14 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
 								</element>
 							</when>
 							<when test="starts-with($text, '🔠') and &sigiled-text;">
-								<element name="html:li">
+								<element name="li" namespace="&xhtml;">
 									<attribute name="class">
 										<text>ordered</text>
 									</attribute>
 									<attribute name="data-level">
 										<text>2</text>
 									</attribute>
-									<element name="html:p">
+									<element name="p" namespace="&xhtml;">
 										<call-template name="LesML:id-and-contents">
 											<with-param name="source" select="&unsigiled-text;"/>
 										</call-template>
@@ -446,14 +447,14 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
 								</element>
 							</when>
 							<when test="starts-with($text, '▪') and &sigiled-text;">
-								<element name="html:li">
+								<element name="li" namespace="&xhtml;">
 									<attribute name="class">
 										<text>unordered</text>
 									</attribute>
 									<attribute name="data-level">
 										<text>3</text>
 									</attribute>
-									<element name="html:p">
+									<element name="p" namespace="&xhtml;">
 										<call-template name="LesML:id-and-contents">
 											<with-param name="source" select="&unsigiled-text;"/>
 										</call-template>
@@ -461,14 +462,14 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
 								</element>
 							</when>
 							<when test="starts-with($text, '🔡') and &sigiled-text;">
-								<element name="html:li">
+								<element name="li" namespace="&xhtml;">
 									<attribute name="class">
 										<text>ordered</text>
 									</attribute>
 									<attribute name="data-level">
 										<text>3</text>
 									</attribute>
-									<element name="html:p">
+									<element name="p" namespace="&xhtml;">
 										<call-template name="LesML:id-and-contents">
 											<with-param name="source" select="&unsigiled-text;"/>
 										</call-template>
@@ -476,14 +477,14 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
 								</element>
 							</when>
 							<when test="starts-with($text, '⁃') and &sigiled-text;">
-								<element name="html:li">
+								<element name="li" namespace="&xhtml;">
 									<attribute name="class">
 										<text>unordered</text>
 									</attribute>
 									<attribute name="data-level">
 										<text>4</text>
 									</attribute>
-									<element name="html:p">
+									<element name="p" namespace="&xhtml;">
 										<call-template name="LesML:id-and-contents">
 											<with-param name="source" select="&unsigiled-text;"/>
 										</call-template>
@@ -491,14 +492,14 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
 								</element>
 							</when>
 							<when test="starts-with($text, '🔣') and &sigiled-text;">
-								<element name="html:li">
+								<element name="li" namespace="&xhtml;">
 									<attribute name="class">
 										<text>ordered</text>
 									</attribute>
 									<attribute name="data-level">
 										<text>4</text>
 									</attribute>
-									<element name="html:p">
+									<element name="p" namespace="&xhtml;">
 										<call-template name="LesML:id-and-contents">
 											<with-param name="source" select="&unsigiled-text;"/>
 										</call-template>
@@ -506,14 +507,14 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
 								</element>
 							</when>
 							<when test="starts-with($text, '🛈') and &sigiled-text;">
-								<element name="html:div">
+								<element name="div" namespace="&xhtml;">
 									<attribute name="role">
 										<text>note</text>
 									</attribute>
 									<attribute name="class">
 										<text>info</text>
 									</attribute>
-									<element name="html:p">
+									<element name="p" namespace="&xhtml;">
 										<call-template name="LesML:id-and-contents">
 											<with-param name="source" select="&unsigiled-text;"/>
 										</call-template>
@@ -521,14 +522,14 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
 								</element>
 							</when>
 							<when test="starts-with($text, '⯑') and &sigiled-text;">
-								<element name="html:div">
+								<element name="div" namespace="&xhtml;">
 									<attribute name="role">
 										<text>note</text>
 									</attribute>
 									<attribute name="class">
 										<text>query</text>
 									</attribute>
-									<element name="html:p">
+									<element name="p" namespace="&xhtml;">
 										<call-template name="LesML:id-and-contents">
 											<with-param name="source" select="&unsigiled-text;"/>
 										</call-template>
@@ -536,14 +537,14 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
 								</element>
 							</when>
 							<when test="starts-with($text, '⚠︎') and &sigiled-text;">
-								<element name="html:div">
+								<element name="div" namespace="&xhtml;">
 									<attribute name="role">
 										<text>note</text>
 									</attribute>
 									<attribute name="class">
 										<text>warn</text>
 									</attribute>
-									<element name="html:p">
+									<element name="p" namespace="&xhtml;">
 										<call-template name="LesML:id-and-contents">
 											<with-param name="source" select="&unsigiled-text;"/>
 										</call-template>
@@ -551,14 +552,14 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
 								</element>
 							</when>
 							<when test="starts-with($text, '※') and &sigiled-text;">
-								<element name="html:div">
+								<element name="div" namespace="&xhtml;">
 									<attribute name="role">
 										<text>note</text>
 									</attribute>
 									<attribute name="class">
 										<text>note</text>
 									</attribute>
-									<element name="html:p">
+									<element name="p" namespace="&xhtml;">
 										<call-template name="LesML:id-and-contents">
 											<with-param name="source" select="&unsigiled-text;"/>
 										</call-template>
@@ -566,14 +567,14 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
 								</element>
 							</when>
 							<when test="starts-with($text, '☡') and &sigiled-text;">
-								<element name="html:div">
+								<element name="div" namespace="&xhtml;">
 									<attribute name="role">
 										<text>note</text>
 									</attribute>
 									<attribute name="class">
 										<text>caution</text>
 									</attribute>
-									<element name="html:p">
+									<element name="p" namespace="&xhtml;">
 										<call-template name="LesML:id-and-contents">
 											<with-param name="source" select="&unsigiled-text;"/>
 										</call-template>
@@ -581,11 +582,11 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
 								</element>
 							</when>
 							<when test="starts-with($text, '⋯') and &sigiled-text;">
-								<element name="html:div">
+								<element name="div" namespace="&xhtml;">
 									<attribute name="class">
 										<text>continuation</text>
 									</attribute>
-									<element name="html:p">
+									<element name="p" namespace="&xhtml;">
 										<call-template name="LesML:id-and-contents">
 											<with-param name="source" select="&unsigiled-text;"/>
 										</call-template>
@@ -598,7 +599,7 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
 								</comment>
 							</when>
 							<otherwise>
-								<element name="html:p">
+								<element name="p" namespace="&xhtml;">
 									<call-template name="LesML:id-and-contents">
 										<with-param name="source" select="$text"/>
 									</call-template>
@@ -608,10 +609,10 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
 					</variable>
 					<choose>
 						<when test="translate(string($text), '&section-break; ', '')=''">
-							<element name="html:hr"/>
+							<element name="hr" namespace="&xhtml;"/>
 						</when>
 						<when test="$quoted">
-							<element name="html:blockquote">
+							<element name="blockquote" namespace="&xhtml;">
 								<copy-of select="$par"/>
 							</element>
 						</when>
@@ -659,11 +660,11 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
 						<value-of select="substring-after($laststarttext, '— ')"/>
 						<copy-of select="$laststarttext/following-sibling::node()"/>
 					</variable>
-					<element name="html:figure">
+					<element name="figure" namespace="&xhtml;">
 						<copy>
 							<apply-templates select="@*|$content-nodes[position()!=last()]" mode="LesML:finalize-tree"/>
 						</copy>
-						<element name="html:figcaption">
+						<element name="figcaption" namespace="&xhtml;">
 							<for-each select="$content-nodes[last()]">
 								<copy>
 									<apply-templates select="@*|exsl:node-set($caption)/node()" mode="LesML:finalize-tree"/>
@@ -711,7 +712,7 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
 			</choose>
 		</variable>
 		<variable name="notinlist" select="following-sibling::node()[not(self::html:div and @class='continuation' or self::html:li and (@data-level>$current-level or @data-level=$current-level and @class=$current-class))][1]"/>
-		<element name="html:{$wrapper}" namespace="http://www.w3.org/1999/xhtml">
+		<element name="{$wrapper}" namespace="&xhtml;">
 			<for-each select=".|following-sibling::html:li[@data-level=$current-level and (not($notinlist) or following-sibling::node()[generate-id()=generate-id($notinlist)])]">
 				<variable name="notcontinuation" select="following-sibling::node()[not(self::html:div and @class='continuation')][1]"/>
 				<copy>
@@ -903,7 +904,7 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
 													<text>{🔗</text>
 												</if>
 											</for-each>
-											<element name="html:a">
+											<element name="a" namespace="&xhtml;">
 												<attribute name="href">
 													<value-of select="$ltcomponents[last()]"/>
 												</attribute>
@@ -968,7 +969,8 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
 	<template match="node()" mode="LesML:strikethrough">
 		<variable name="result">
 			<apply-templates select="." mode="LesML:inline">
-				<with-param name="element-name" select="'html:s'"/>
+				<with-param name="element-name" select="'s'"/>
+				<with-param name="element-namespace" select="'&xhtml;'"/>
 				<with-param name="start-sigil" select="'⸠'"/>
 				<with-param name="end-sigil" select="'⸡'"/>
 			</apply-templates>
@@ -978,7 +980,8 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
 	<template match="node()" mode="LesML:underline">
 		<variable name="result">
 			<apply-templates select="." mode="LesML:inline">
-				<with-param name="element-name" select="'html:u'"/>
+				<with-param name="element-name" select="'u'"/>
+				<with-param name="element-namespace" select="'&xhtml;'"/>
 				<with-param name="start-sigil" select="'⸤'"/>
 				<with-param name="end-sigil" select="'⸥'"/>
 			</apply-templates>
@@ -988,7 +991,8 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
 	<template match="node()" mode="LesML:noted">
 		<variable name="result">
 			<apply-templates select="." mode="LesML:inline">
-				<with-param name="element-name" select="'html:small'"/>
+				<with-param name="element-name" select="'small'"/>
+				<with-param name="element-namespace" select="'&xhtml;'"/>
 				<with-param name="start-sigil" select="'⟦'"/>
 				<with-param name="end-sigil" select="'⟧'"/>
 				<with-param name="role" select="'note'"/>
@@ -999,29 +1003,21 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
 	<template match="node()" mode="LesML:parenthetical">
 		<variable name="result">
 			<apply-templates select="." mode="LesML:inline">
-				<with-param name="element-name" select="'html:small'"/>
+				<with-param name="element-name" select="'small'"/>
+				<with-param name="element-namespace" select="'&xhtml;'"/>
 				<with-param name="start-sigil" select="'⸨'"/>
 				<with-param name="end-sigil" select="'⸩'"/>
 			</apply-templates>
 		</variable>
-		<apply-templates select="exsl:node-set($result)/node()" mode="LesML:important"/>
-	</template>
-	<template match="node()" mode="LesML:important">
-		<variable name="result">
-			<apply-templates select="." mode="LesML:inline">
-				<with-param name="element-name" select="'html:strong'"/>
-				<with-param name="start-sigil" select="'☞'"/>
-				<with-param name="end-sigil" select="'☜'"/>
-			</apply-templates>
-		</variable>
-		<apply-templates select="exsl:node-set($result)/node()" mode="LesML:emphasized"/>
+		<apply-templates select="exsl:node-set($result)/node()" mode="LesML:code"/>
 	</template>
-	<template match="node()" mode="LesML:emphasized">
+	<template match="node()" mode="LesML:code">
 		<variable name="result">
 			<apply-templates select="." mode="LesML:inline">
-				<with-param name="element-name" select="'html:em'"/>
-				<with-param name="start-sigil" select="'⹐'"/>
-				<with-param name="end-sigil" select="'⹑'"/>
+				<with-param name="element-name" select="'code'"/>
+				<with-param name="element-namespace" select="'&xhtml;'"/>
+				<with-param name="start-sigil" select="'`'"/>
+				<with-param name="end-sigil" select="'´'"/>
 			</apply-templates>
 		</variable>
 		<apply-templates select="exsl:node-set($result)/node()" mode="LesML:titled"/>
@@ -1029,7 +1025,8 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
 	<template match="node()" mode="LesML:titled">
 		<variable name="result">
 			<apply-templates select="." mode="LesML:inline">
-				<with-param name="element-name" select="'html:cite'"/>
+				<with-param name="element-name" select="'cite'"/>
+				<with-param name="element-namespace" select="'&xhtml;'"/>
 				<with-param name="start-sigil" select="'⟪'"/>
 				<with-param name="end-sigil" select="'⟫'"/>
 			</apply-templates>
@@ -1039,7 +1036,8 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
 	<template match="node()" mode="LesML:offset">
 		<variable name="result">
 			<apply-templates select="." mode="LesML:inline">
-				<with-param name="element-name" select="'html:i'"/>
+				<with-param name="element-name" select="'i'"/>
+				<with-param name="element-namespace" select="'&xhtml;'"/>
 				<with-param name="start-sigil" select="'⟨'"/>
 				<with-param name="end-sigil" select="'⟩'"/>
 				<with-param name="langtag-supported" select="true()"/>
@@ -1050,18 +1048,31 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
 	<template match="node()" mode="LesML:bolded">
 		<variable name="result">
 			<apply-templates select="." mode="LesML:inline">
-				<with-param name="element-name" select="'html:b'"/>
+				<with-param name="element-name" select="'b'"/>
+				<with-param name="element-namespace" select="'&xhtml;'"/>
 				<with-param name="start-sigil" select="'⦃'"/>
 				<with-param name="end-sigil" select="'⦄'"/>
 			</apply-templates>
 		</variable>
-		<apply-templates select="exsl:node-set($result)/node()" mode="LesML:code"/>
+		<apply-templates select="exsl:node-set($result)/node()" mode="LesML:important"/>
 	</template>
-	<template match="node()" mode="LesML:code">
+	<template match="node()" mode="LesML:important">
+		<variable name="result">
+			<apply-templates select="." mode="LesML:inline">
+				<with-param name="element-name" select="'strong'"/>
+				<with-param name="element-namespace" select="'&xhtml;'"/>
+				<with-param name="start-sigil" select="'☞'"/>
+				<with-param name="end-sigil" select="'☜'"/>
+			</apply-templates>
+		</variable>
+		<apply-templates select="exsl:node-set($result)/node()" mode="LesML:emphasized"/>
+	</template>
+	<template match="node()" mode="LesML:emphasized">
 		<apply-templates select="." mode="LesML:inline">
-			<with-param name="element-name" select="'html:code'"/>
-			<with-param name="start-sigil" select="'`'"/>
-			<with-param name="end-sigil" select="'´'"/>
+			<with-param name="element-name" select="'em'"/>
+			<with-param name="element-namespace" select="'&xhtml;'"/>
+			<with-param name="start-sigil" select="'⹐'"/>
+			<with-param name="end-sigil" select="'⹑'"/>
 		</apply-templates>
 	</template>
 </transform>