]> Lady’s Gitweb - Shrine-XSLT/commitdiff
Move slotted elements to end of <head> 0.1.1
authorLady <redacted>
Sun, 6 Nov 2022 04:01:24 +0000 (21:01 -0700)
committerLady <redacted>
Sat, 29 Apr 2023 03:03:04 +0000 (20:03 -0700)
transform.xslt

index 0bd34a83758041a036fc0fca43a89aa7435197c5..2e3c7bd3e45f51b41d7dcfe128ac3e7354d2b74e 100644 (file)
@@ -42,6 +42,7 @@ If a copy of the MPL was not distributed with this file, You can obtain one at h
        <!--
                Process non‐template elements.
                By default, just copy the element, but remove any `@data-shrine-*` attribuets or `@slot` attributes with a value that begins with `shrine-`.
        <!--
                Process non‐template elements.
                By default, just copy the element, but remove any `@data-shrine-*` attribuets or `@slot` attributes with a value that begins with `shrine-`.
+               Some elements may have special treatment.
        -->
        <xslt:template match="*|text()" mode="content">
                <xslt:copy>
        -->
        <xslt:template match="*|text()" mode="content">
                <xslt:copy>
@@ -78,7 +79,7 @@ If a copy of the MPL was not distributed with this file, You can obtain one at h
        </xslt:template>
 
        <!--
        </xslt:template>
 
        <!--
-               Process the template `<html>`.
+               Process the template `<html>` elements.
                This copies over `@lang` and non‐shrine `@data-*` attributes from the root node.
        -->
        <xslt:template match="html:html" mode="template">
                This copies over `@lang` and non‐shrine `@data-*` attributes from the root node.
        -->
        <xslt:template match="html:html" mode="template">
@@ -96,7 +97,7 @@ If a copy of the MPL was not distributed with this file, You can obtain one at h
        </xslt:template>
 
        <!--
        </xslt:template>
 
        <!--
-               Process the template `<head>`.
+               Process the template `<head>` elements.
                This inserts appropriate metadata based on the document.
        -->
        <xslt:template match="html:head" mode="template">
                This inserts appropriate metadata based on the document.
        -->
        <xslt:template match="html:head" mode="template">
@@ -104,10 +105,6 @@ If a copy of the MPL was not distributed with this file, You can obtain one at h
                        <xslt:for-each select="@*">
                                <xslt:copy/>
                        </xslt:for-each>
                        <xslt:for-each select="@*">
                                <xslt:copy/>
                        </xslt:for-each>
-                       <xslt:for-each select="exslt:node-set($source)//*[@slot='shrine-head']">
-                               <xslt:text>&#x0A;</xslt:text>
-                               <xslt:apply-templates select="." mode="content"/>
-                       </xslt:for-each>
                        <xslt:if test="not(exslt:node-set($source)//html:title[@slot='shrine-head'])">
                                <xslt:text>&#x0A;</xslt:text>
                                <title>
                        <xslt:if test="not(exslt:node-set($source)//html:title[@slot='shrine-head'])">
                                <xslt:text>&#x0A;</xslt:text>
                                <title>
@@ -115,6 +112,10 @@ If a copy of the MPL was not distributed with this file, You can obtain one at h
                                </title>
                        </xslt:if>
                        <xslt:apply-templates mode="template"/>
                                </title>
                        </xslt:if>
                        <xslt:apply-templates mode="template"/>
+                       <xslt:for-each select="exslt:node-set($source)//*[@slot='shrine-head']">
+                               <xslt:text>&#x0A;</xslt:text>
+                               <xslt:apply-templates select="." mode="content"/>
+                       </xslt:for-each>
                </xslt:copy>
        </xslt:template>
 
                </xslt:copy>
        </xslt:template>
 
This page took 0.022847 seconds and 4 git commands to generate.