From: Lady <redacted> Date: Fri, 20 Sep 2024 03:21:04 +0000 (-0400) Subject: Don’t remove invalid @书社:* attributes X-Git-Tag: 0.13.0~2 X-Git-Url: https://git.ladys.computer/Shushe/commitdiff_plain/2c60920156e8a1ff1749f3e94316510d03a53a85?ds=inline Don’t remove invalid @书社:* attributes There is a lot of difficult logic particularly around `@书社:archived-as` to remove it if it won’t have any effect. This is unnecessary and it is probably better to just leave these attributes untouched (akin to how `<书社:link>` is left untouched when invalid). --- diff --git a/lib/catalog2transform.xslt b/lib/catalog2transform.xslt index 2c555e3..10a5479 100644 --- a/lib/catalog2transform.xslt +++ b/lib/catalog2transform.xslt @@ -143,8 +143,8 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one <xslt:choose> <xslt:when test="@namespace-uri='&xml;'"/> <xslt:when test="$context[self::html:* or self::svg:*] and @namespace-uri='' and @local-name='lang'"/> - <xslt:when test="@namespace-uri='&书社;' and @local-name='archived-as' and $context-nodes/ancestor::*[not(self::书社:apply-attributes-to-root or self::书社:apply-attributes)][position()=1 and not(self::书社:archive)]"/> - <xslt:when test="@namespace-uri='&书社;' and (@local-name='destination' or @local-name='disable-output-wrapping' or @local-name='version')"/> + <xslt:when test="$and-version and $THISREV and @namespace-uri='&书社;' and @local-name='version'"/> + <xslt:when test="@namespace-uri='&书社;' and (@local-name='destination' or @local-name='disable-output-wrapping')"/> <xslt:when test="preceding-sibling::*[@local-name=current()/@local-name and @namespace-uri=current()/@namespace-uri]"/> <xslt:otherwise> <xslt:attribute> @@ -294,17 +294,10 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one <xslt:apply-templates select="@*|node()"/> </xslt:copy> </xslt:template> - <xslt:template match="@书社:destination|@书社:disable-output-wrapping|@书社:archived-as[../ancestor::*[not(self::书社:apply-attributes-to-root or self::书社:apply-attributes)]]" mode="书社:apply" priority="1"/> + <xslt:template match="@书社:destination|@书社:disable-output-wrapping" mode="书社:apply" priority="1"/> <xslt:template match="书社:archive" mode="书社:apply" priority="1"> <xslt:copy> - <xslt:for-each select="@*"> - <xslt:choose> - <xslt:when test="local-name()='archived-as' and namespace-uri()='&书社;' and ../ancestor::*[not(self::书社:apply-attributes-to-root or self::书社:apply-attributes)]"/> - <xslt:otherwise> - <xslt:apply-templates select="." mode="书社:apply"/> - </xslt:otherwise> - </xslt:choose> - </xslt:for-each> + <xslt:apply-templates select="@*" mode="书社:apply"/> <xslt:for-each select="node()"> <xslt:choose> <xslt:when test="self::*">