From: Lady <redacted> Date: Sun, 4 Feb 2024 01:01:49 +0000 (-0500) Subject: Apply @书社:cksum to result when parsing X-Git-Tag: 0.5.3~2 X-Git-Url: https://git.ladys.computer/Shushe/commitdiff_plain/ce0bf3e5b97a5dadbaf14f91a4170dc4f2a4f8e1?ds=inline Apply @书社:cksum to result when parsing Because this indiscriminately adds the attribute to the result of parsing the root node, the checksum should be added for both X·M·L and plaintext sources. --- diff --git a/lib/catalog2parser.xslt b/lib/catalog2parser.xslt index eb35e80..9780013 100644 --- a/lib/catalog2parser.xslt +++ b/lib/catalog2parser.xslt @@ -100,7 +100,24 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one </xslt:for-each> </xslt:template> <xslt:template match="/"> - <xslt:apply-templates select="node()" mode="书社:parse"/> + <xslt:variable name="parsedroot"> + <xslt:apply-templates select="node()" mode="书社:parse"/> + </xslt:variable> + <xslt:for-each select="exsl:node-set($parsedroot)/node()"> + <xslt:choose> + <xslt:when test="self::*"> + <xslt:copy> + <xslt:attribute name="书社:cksum"> + <xslt:value-of select="$CKSUM"/> + </xslt:attribute> + <xslt:copy-of select="@*|node()"/> + </xslt:copy> + </xslt:when> + <xslt:otherwise> + <xslt:copy-of select="."/> + </xslt:otherwise> + </xslt:choose> + </xslt:for-each> </xslt:template> <xslt:template match="@*|node()" priority="-1"> <xslt:copy>