From: Lady Date: Fri, 20 Sep 2024 03:21:16 +0000 (-0400) Subject: Apply attributes at every stage X-Git-Tag: 0.13.0~1 X-Git-Url: https://git.ladys.computer/Shushe/commitdiff_plain/23832d1a6f6bf4d2adce00d6e5ff65290aaa1ef1?hp=2c60920156e8a1ff1749f3e94316510d03a53a85 Apply attributes at every stage Previously, there was a lot of complicated logic to account for the fact that certain important attributes might not be added until the end of the transformation process (via `<书社:apply-attributes>` or `<书社:apply-attributes-to-root>`). It’s much simpler, conceptually, to just apply attributes after every transformation phase and not worry about them besides. This does mean that if an embed contains an `<书社:apply-attributes-to-root>` element, it _will_ almost definitely be applied when·ever that embed is embedded, before the next phase gets a chance to put a word in edge·wise. Presumably, tho, this is one of the main utilities of the `<书社:apply-attributes-to-root>` element in the first place, so maybe that is okay. This commit introduces a new `书社:finalize` mode for things wot used to be in the `书社:apply` mode but weren’t actually related to attribute application. --- diff --git a/README.markdown b/README.markdown index 503a163..af78725 100644 --- a/README.markdown +++ b/README.markdown @@ -585,7 +585,7 @@ Transforms are used to convert X·M·L files into their final output, media types into the appropriate H·T·M·L elements, and deletes `` elements from the body of the document and moves them to the head. - This conversion happens during the application phase, after the main + This conversion happens during the finalization phase, after the main transformation. - **`transforms/metadata.xslt`:** @@ -604,7 +604,7 @@ Transforms are used to convert X·M·L files into their final output, - **`transforms/serialization.xslt`:** Replaces `<书社:serialize-xml>` elements with the (escaped) serialized X·M·L of their contents. - This replacement happens during the application phase, after most + This replacement happens during the finalization phase, after most other transformations have taken place. If a `@with-namespaces` attribute is provided, any name·space nodes @@ -730,8 +730,8 @@ It is especially useful in combination with output wrapping. In both cases, attributes from various sources are combined with white·space between them. -Attribute application takes place after all ordinary transforms have - completed. +Attribute application takes place after each stage of the + transformation, including after the initial embedding phase. Both elements ignore attributes in the `xml:` name·space, except for `@xml:lang`, which ignores all but the first definition (including diff --git a/lib/catalog2transform.xslt b/lib/catalog2transform.xslt index 10a5479..68fb3a2 100644 --- a/lib/catalog2transform.xslt +++ b/lib/catalog2transform.xslt @@ -19,6 +19,7 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one xmlns="http://www.w3.org/1999/XSL/Transform" xmlns:catalog="urn:oasis:names:tc:entity:xmlns:xml:catalog" xmlns:exsl="http://exslt.org/common" + xmlns:exslfunc="http://exslt.org/functions" xmlns:exslstr="http://exslt.org/strings" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:nie="http://www.semanticdesktop.org/ontologies/2007/01/19/nie#" @@ -51,26 +52,50 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one - + + + + 书社:document-with-attributes-applied + + + + + + + + + + + + + + + + + + exsl:node-set($application-result-fragment) + + + - + - + - + @@ -261,105 +286,17 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one - - - - - - - - - - - - - - - - - - - - - - - - - + + + - + - - - - - - - - - - - - - itemscope - - - - - - - - - - - - - - - - - &书社;:document - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -503,6 +440,79 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one + + + + + + + + + + + + itemscope + + + + + + + + + + + + + + + + + &书社;:document + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/transforms/asset.xslt b/transforms/asset.xslt index 38d2e67..2b43595 100644 --- a/transforms/asset.xslt +++ b/transforms/asset.xslt @@ -23,23 +23,23 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one version="1.0" > <书社:id>urn:fdc:ladys.computer:20231231:Shu1She4:asset.xslt -