From: Lady <redacted> Date: Sun, 6 Nov 2022 04:01:24 +0000 (-0700) Subject: Move slotted elements to end of <head> X-Git-Tag: 0.1.1^0 X-Git-Url: https://git.ladys.computer/Shrine-XSLT/commitdiff_plain/fcf6e8708b196a5e91351230b4b9ad18671b3f30?ds=inline Move slotted elements to end of <head> --- diff --git a/transform.xslt b/transform.xslt index 0bd34a8..2e3c7bd 100644 --- a/transform.xslt +++ b/transform.xslt @@ -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-`. + Some elements may have special treatment. --> <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> <!-- - 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"> @@ -96,7 +97,7 @@ If a copy of the MPL was not distributed with this file, You can obtain one at h </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"> @@ -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="exslt:node-set($source)//*[@slot='shrine-head']"> - <xslt:text>
</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>
</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"/> + <xslt:for-each select="exslt:node-set($source)//*[@slot='shrine-head']"> + <xslt:text>
</xslt:text> + <xslt:apply-templates select="." mode="content"/> + </xslt:for-each> </xslt:copy> </xslt:template>