It’s simpler and cleaner to always just create elements with
`<xslt:element>`, as these never inherit name·spaces from their
surrounding context.
<with-param name="source" select="string()"/>
</call-template>
<if test="position()!=count($broken)">
<with-param name="source" select="string()"/>
</call-template>
<if test="position()!=count($broken)">
+ <element name="html:br"/>
</if>
</for-each>
</template>
</if>
</for-each>
</template>
</if>
<if test="$shebang!='' or $doclines[normalize-space()!='']">
<variable name="record-separators" select="$doclines[starts-with(., '%%')]"/>
</if>
<if test="$shebang!='' or $doclines[normalize-space()!='']">
<variable name="record-separators" select="$doclines[starts-with(., '%%')]"/>
+ <element name="html:article">
<for-each select="$params/html:div/html:dt[string()=' LANG ']">
<attribute name="lang">
<value-of select="following-sibling::html:dd"/>
<for-each select="$params/html:div/html:dt[string()=' LANG ']">
<attribute name="lang">
<value-of select="following-sibling::html:dd"/>
</attribute>
</for-each>
<if test="$record-separators[preceding-sibling::*[normalize-space()!='']]">
</attribute>
</for-each>
<if test="$record-separators[preceding-sibling::*[normalize-space()!='']]">
- <html:footer class="head">
+ <element name="html:footer">
+ <attribute name="class">
+ <text>head</text>
+ </attribute>
<for-each select="$record-separators">
<variable name="position" select="position()"/>
<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">
<for-each select="$record-separators">
<variable name="position" select="position()"/>
<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">
<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(., ' '))]"/>
<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">
<value-of select="normalize-space(substring-before(., ':'))"/>
<value-of select="normalize-space(substring-before(., ':'))"/>
+ </element>
+ <element name="html:dd">
<variable name="firstline">
<choose>
<when test="contains(., ':')">
<variable name="firstline">
<choose>
<when test="contains(., ':')">
</otherwise>
</choose>
</for-each>
</otherwise>
</choose>
</for-each>
- </html:dd>
- </html:div>
+ </element>
+ </element>
</otherwise>
</choose>
</for-each>
</otherwise>
</choose>
</for-each>
</if>
<if test=".!='%%'">
<comment>
</if>
<if test=".!='%%'">
<comment>
</comment>
</if>
</for-each>
</comment>
</if>
</for-each>
- <html:div class="body">
+ <element name="html:div">
+ <attribute name="class">
+ <text>body</text>
+ </attribute>
<call-template name="LesML:paragraphize">
<with-param name="lines" select="$doclines[not($record-separators) or preceding-sibling::*[generate-id()=generate-id($record-separators[last()])]]"/>
</call-template>
<call-template name="LesML:paragraphize">
<with-param name="lines" select="$doclines[not($record-separators) or preceding-sibling::*[generate-id()=generate-id($record-separators[last()])]]"/>
</call-template>
- </html:div>
- </html:article>
+ </element>
+ </element>
</if>
<if test="$docsep">
<call-template name="LesML:parse">
</if>
<if test="$docsep">
<call-template name="LesML:parse">
<variable name="par">
<choose>
<when test="$preformatted">
<variable name="par">
<choose>
<when test="$preformatted">
+ <element name="html:pre">
<call-template name="LesML:id-and-contents">
<with-param name="source" select="$text"/>
</call-template>
<call-template name="LesML:id-and-contents">
<with-param name="source" select="$text"/>
</call-template>
</when>
<when test="starts-with($text, '⁌') and &sigiled-text;">
</when>
<when test="starts-with($text, '⁌') and &sigiled-text;">
+ <element name="html:h1">
<call-template name="LesML:id-and-contents">
<with-param name="source" select="&unsigiled-text;"/>
</call-template>
<call-template name="LesML:id-and-contents">
<with-param name="source" select="&unsigiled-text;"/>
</call-template>
</when>
<when test="starts-with($text, '§') and &sigiled-text;">
</when>
<when test="starts-with($text, '§') and &sigiled-text;">
+ <element name="html:h2">
<call-template name="LesML:id-and-contents">
<with-param name="source" select="&unsigiled-text;"/>
</call-template>
<call-template name="LesML:id-and-contents">
<with-param name="source" select="&unsigiled-text;"/>
</call-template>
</when>
<when test="starts-with($text, '❦') and &sigiled-text;">
</when>
<when test="starts-with($text, '❦') and &sigiled-text;">
+ <element name="html:h3">
<call-template name="LesML:id-and-contents">
<with-param name="source" select="&unsigiled-text;"/>
</call-template>
<call-template name="LesML:id-and-contents">
<with-param name="source" select="&unsigiled-text;"/>
</call-template>
</when>
<when test="starts-with($text, '✠') and &sigiled-text;">
</when>
<when test="starts-with($text, '✠') and &sigiled-text;">
+ <element name="html:h4">
<call-template name="LesML:id-and-contents">
<with-param name="source" select="&unsigiled-text;"/>
</call-template>
<call-template name="LesML:id-and-contents">
<with-param name="source" select="&unsigiled-text;"/>
</call-template>
</when>
<when test="starts-with($text, '•') and &sigiled-text;">
</when>
<when test="starts-with($text, '•') and &sigiled-text;">
- <html:li class="unordered" data-level="1">
- <html:p>
+ <element name="html:li">
+ <attribute name="class">
+ <text>unordered</text>
+ </attribute>
+ <attribute name="data-level">
+ <text>1</text>
+ </attribute>
+ <element name="html:p">
<call-template name="LesML:id-and-contents">
<with-param name="source" select="&unsigiled-text;"/>
</call-template>
<call-template name="LesML:id-and-contents">
<with-param name="source" select="&unsigiled-text;"/>
</call-template>
+ </element>
+ </element>
</when>
<when test="starts-with($text, '🔢') and &sigiled-text;">
</when>
<when test="starts-with($text, '🔢') and &sigiled-text;">
- <html:li class="ordered" data-level="1">
- <html:p>
+ <element name="html:li">
+ <attribute name="class">
+ <text>ordered</text>
+ </attribute>
+ <attribute name="data-level">
+ <text>1</text>
+ </attribute>
+ <element name="html:p">
<call-template name="LesML:id-and-contents">
<with-param name="source" select="&unsigiled-text;"/>
</call-template>
<call-template name="LesML:id-and-contents">
<with-param name="source" select="&unsigiled-text;"/>
</call-template>
+ </element>
+ </element>
</when>
<when test="starts-with($text, '◦') and &sigiled-text;">
</when>
<when test="starts-with($text, '◦') and &sigiled-text;">
- <html:li class="unordered" data-level="2">
- <html:p>
+ <element name="html:li">
+ <attribute name="class">
+ <text>unordered</text>
+ </attribute>
+ <attribute name="data-level">
+ <text>2</text>
+ </attribute>
+ <element name="html:p">
<call-template name="LesML:id-and-contents">
<with-param name="source" select="&unsigiled-text;"/>
</call-template>
<call-template name="LesML:id-and-contents">
<with-param name="source" select="&unsigiled-text;"/>
</call-template>
+ </element>
+ </element>
</when>
<when test="starts-with($text, '🔠') and &sigiled-text;">
</when>
<when test="starts-with($text, '🔠') and &sigiled-text;">
- <html:li class="ordered" data-level="2">
- <html:p>
+ <element name="html:li">
+ <attribute name="class">
+ <text>ordered</text>
+ </attribute>
+ <attribute name="data-level">
+ <text>2</text>
+ </attribute>
+ <element name="html:p">
<call-template name="LesML:id-and-contents">
<with-param name="source" select="&unsigiled-text;"/>
</call-template>
<call-template name="LesML:id-and-contents">
<with-param name="source" select="&unsigiled-text;"/>
</call-template>
+ </element>
+ </element>
</when>
<when test="starts-with($text, '▪') and &sigiled-text;">
</when>
<when test="starts-with($text, '▪') and &sigiled-text;">
- <html:li class="unordered" data-level="3">
- <html:p>
+ <element name="html:li">
+ <attribute name="class">
+ <text>unordered</text>
+ </attribute>
+ <attribute name="data-level">
+ <text>3</text>
+ </attribute>
+ <element name="html:p">
<call-template name="LesML:id-and-contents">
<with-param name="source" select="&unsigiled-text;"/>
</call-template>
<call-template name="LesML:id-and-contents">
<with-param name="source" select="&unsigiled-text;"/>
</call-template>
+ </element>
+ </element>
</when>
<when test="starts-with($text, '🔡') and &sigiled-text;">
</when>
<when test="starts-with($text, '🔡') and &sigiled-text;">
- <html:li class="ordered" data-level="3">
- <html:p>
+ <element name="html:li">
+ <attribute name="class">
+ <text>ordered</text>
+ </attribute>
+ <attribute name="data-level">
+ <text>3</text>
+ </attribute>
+ <element name="html:p">
<call-template name="LesML:id-and-contents">
<with-param name="source" select="&unsigiled-text;"/>
</call-template>
<call-template name="LesML:id-and-contents">
<with-param name="source" select="&unsigiled-text;"/>
</call-template>
+ </element>
+ </element>
</when>
<when test="starts-with($text, '⁃') and &sigiled-text;">
</when>
<when test="starts-with($text, '⁃') and &sigiled-text;">
- <html:li class="unordered" data-level="4">
- <html:p>
+ <element name="html:li">
+ <attribute name="class">
+ <text>unordered</text>
+ </attribute>
+ <attribute name="data-level">
+ <text>4</text>
+ </attribute>
+ <element name="html:p">
<call-template name="LesML:id-and-contents">
<with-param name="source" select="&unsigiled-text;"/>
</call-template>
<call-template name="LesML:id-and-contents">
<with-param name="source" select="&unsigiled-text;"/>
</call-template>
+ </element>
+ </element>
</when>
<when test="starts-with($text, '🔣') and &sigiled-text;">
</when>
<when test="starts-with($text, '🔣') and &sigiled-text;">
- <html:li class="ordered" data-level="4">
- <html:p>
+ <element name="html:li">
+ <attribute name="class">
+ <text>ordered</text>
+ </attribute>
+ <attribute name="data-level">
+ <text>4</text>
+ </attribute>
+ <element name="html:p">
<call-template name="LesML:id-and-contents">
<with-param name="source" select="&unsigiled-text;"/>
</call-template>
<call-template name="LesML:id-and-contents">
<with-param name="source" select="&unsigiled-text;"/>
</call-template>
+ </element>
+ </element>
</when>
<when test="starts-with($text, '🛈') and &sigiled-text;">
</when>
<when test="starts-with($text, '🛈') and &sigiled-text;">
- <html:div role="note" class="info">
- <html:p>
+ <element name="html:div">
+ <attribute name="role">
+ <text>note</text>
+ </attribute>
+ <attribute name="class">
+ <text>info</text>
+ </attribute>
+ <element name="html:p">
<call-template name="LesML:id-and-contents">
<with-param name="source" select="&unsigiled-text;"/>
</call-template>
<call-template name="LesML:id-and-contents">
<with-param name="source" select="&unsigiled-text;"/>
</call-template>
- </html:p>
- </html:div>
+ </element>
+ </element>
</when>
<when test="starts-with($text, '⯑') and &sigiled-text;">
</when>
<when test="starts-with($text, '⯑') and &sigiled-text;">
- <html:div role="note" class="query">
- <html:p>
+ <element name="html:div">
+ <attribute name="role">
+ <text>note</text>
+ </attribute>
+ <attribute name="class">
+ <text>query</text>
+ </attribute>
+ <element name="html:p">
<call-template name="LesML:id-and-contents">
<with-param name="source" select="&unsigiled-text;"/>
</call-template>
<call-template name="LesML:id-and-contents">
<with-param name="source" select="&unsigiled-text;"/>
</call-template>
- </html:p>
- </html:div>
+ </element>
+ </element>
</when>
<when test="starts-with($text, '⚠︎') and &sigiled-text;">
</when>
<when test="starts-with($text, '⚠︎') and &sigiled-text;">
- <html:div role="note" class="warn">
- <html:p>
+ <element name="html:div">
+ <attribute name="role">
+ <text>note</text>
+ </attribute>
+ <attribute name="class">
+ <text>warn</text>
+ </attribute>
+ <element name="html:p">
<call-template name="LesML:id-and-contents">
<with-param name="source" select="&unsigiled-text;"/>
</call-template>
<call-template name="LesML:id-and-contents">
<with-param name="source" select="&unsigiled-text;"/>
</call-template>
- </html:p>
- </html:div>
+ </element>
+ </element>
</when>
<when test="starts-with($text, '※') and &sigiled-text;">
</when>
<when test="starts-with($text, '※') and &sigiled-text;">
- <html:div role="note" class="note">
- <html:p>
+ <element name="html:div">
+ <attribute name="role">
+ <text>note</text>
+ </attribute>
+ <attribute name="class">
+ <text>note</text>
+ </attribute>
+ <element name="html:p">
<call-template name="LesML:id-and-contents">
<with-param name="source" select="&unsigiled-text;"/>
</call-template>
<call-template name="LesML:id-and-contents">
<with-param name="source" select="&unsigiled-text;"/>
</call-template>
- </html:p>
- </html:div>
+ </element>
+ </element>
</when>
<when test="starts-with($text, '☡') and &sigiled-text;">
</when>
<when test="starts-with($text, '☡') and &sigiled-text;">
- <html:div role="note" class="caution">
- <html:p>
+ <element name="html:div">
+ <attribute name="role">
+ <text>note</text>
+ </attribute>
+ <attribute name="class">
+ <text>caution</text>
+ </attribute>
+ <element name="html:p">
<call-template name="LesML:id-and-contents">
<with-param name="source" select="&unsigiled-text;"/>
</call-template>
<call-template name="LesML:id-and-contents">
<with-param name="source" select="&unsigiled-text;"/>
</call-template>
- </html:p>
- </html:div>
+ </element>
+ </element>
</when>
<when test="starts-with($text, '⋯') and &sigiled-text;">
</when>
<when test="starts-with($text, '⋯') and &sigiled-text;">
- <html:div class="continuation">
- <html:p>
+ <element name="html:div">
+ <attribute name="class">
+ <text>continuation</text>
+ </attribute>
+ <element name="html:p">
<call-template name="LesML:id-and-contents">
<with-param name="source" select="&unsigiled-text;"/>
</call-template>
<call-template name="LesML:id-and-contents">
<with-param name="source" select="&unsigiled-text;"/>
</call-template>
- </html:p>
- </html:div>
+ </element>
+ </element>
</when>
<when test="starts-with($text, '#') and &sigiled-text;">
<comment>
</when>
<when test="starts-with($text, '#') and &sigiled-text;">
<comment>
</comment>
</when>
<otherwise>
</comment>
</when>
<otherwise>
+ <element name="html:p">
<call-template name="LesML:id-and-contents">
<with-param name="source" select="$text"/>
</call-template>
<call-template name="LesML:id-and-contents">
<with-param name="source" select="$text"/>
</call-template>
</otherwise>
</choose>
</variable>
<choose>
<when test="translate(string($text), '§ion-break; ', '')=''">
</otherwise>
</choose>
</variable>
<choose>
<when test="translate(string($text), '§ion-break; ', '')=''">
+ <element name="html:hr"/>
</when>
<when test="$quoted">
</when>
<when test="$quoted">
+ <element name="html:blockquote">
</when>
<otherwise>
<copy-of select="$par"/>
</when>
<otherwise>
<copy-of select="$par"/>
<value-of select="substring-after($laststarttext, '— ')"/>
<copy-of select="$laststarttext/following-sibling::node()"/>
</variable>
<value-of select="substring-after($laststarttext, '— ')"/>
<copy-of select="$laststarttext/following-sibling::node()"/>
</variable>
+ <element name="html:figure">
<copy>
<apply-templates select="@*|$content-nodes[position()!=last()]" mode="LesML:finalize-tree"/>
</copy>
<copy>
<apply-templates select="@*|$content-nodes[position()!=last()]" mode="LesML:finalize-tree"/>
</copy>
+ <element name="html:figcaption">
<for-each select="$content-nodes[last()]">
<copy>
<apply-templates select="@*|exsl:node-set($caption)/node()" mode="LesML:finalize-tree"/>
</copy>
</for-each>
<for-each select="$content-nodes[last()]">
<copy>
<apply-templates select="@*|exsl:node-set($caption)/node()" mode="LesML:finalize-tree"/>
</copy>
</for-each>
- </html:figcaption>
- </html:figure>
+ </element>
+ </element>
</when>
<otherwise>
<copy>
</when>
<otherwise>
<copy>
</variable>
<copy-of select="$start-node/preceding-sibling::node()"/>
<value-of select="substring-before($start-node, '{🔗')"/>
</variable>
<copy-of select="$start-node/preceding-sibling::node()"/>
<value-of select="substring-before($start-node, '{🔗')"/>
- <html:a href="{$ltcomponent-nodes[last()]}">
+ <element name="html:a">
+ <attribute name="href">
+ <value-of select="$ltcomponent-nodes[last()]"/>
+ </attribute>
<choose>
<when test="count($ltcomponent-nodes)>2 or normalize-space($ltcomponent-nodes[1])!=''">
<value-of select="$ltcomponent-nodes[1]"/>
<choose>
<when test="count($ltcomponent-nodes)>2 or normalize-space($ltcomponent-nodes[1])!=''">
<value-of select="$ltcomponent-nodes[1]"/>
<value-of select="$ltcomponent-nodes[last()]"/>
</otherwise>
</choose>
<value-of select="$ltcomponent-nodes[last()]"/>
</otherwise>
</choose>
<copy-of select="exsl:node-set($processed-rest)/*/node()"/>
</when>
<otherwise>
<copy-of select="exsl:node-set($processed-rest)/*/node()"/>
</when>
<otherwise>