From: Lady <redacted> Date: Sun, 14 Apr 2024 23:38:07 +0000 (-0400) Subject: Allow injecting raw output in X·M·L serialization X-Git-Tag: 0.7.2^0 X-Git-Url: https://git.ladys.computer/Shushe/commitdiff_plain/751a861d9f521d4c8472bb754e7438e675aaf8a5?ds=sidebyside;hp=3dc36d1f23aff7cb60b498d88e503b619a7bc543 Allow injecting raw output in X·M·L serialization It’s not possible to serialize things like entities using the normal X·S·L·T processes. With this commit, one can instead use something like `<书社:raw-output>&my-entity;</书社:raw-output>` inside of `<书社:serialize-xml>` elements to get this result. --- diff --git a/README.markdown b/README.markdown index 643a4d8..8a0ebe1 100644 --- a/README.markdown +++ b/README.markdown @@ -75,7 +75,7 @@ Compilation involves the following steps :— 6. ⛩️📰 书社 compiles each output file to `build/result`. -7. ⛩️📰 书社 symlinks most output files from `build/result` to +7. ⛩️📰 书社 copies most output files from `build/result` to `build/public`, but it does some additional processing instead on those which indicate a non‐X·M·L desired final output form. @@ -459,6 +459,10 @@ Transforms are used to convert X·M·L files into their final output, It is not possible to selectively only declare one prefix for a name·space to the exclusion of others. + `<书社:raw-output>` elements may be used inside of + `<书社:serialize-xml>` elements to inject raw output into the + serialized X·M·L. + The following are recommendations on effective creation of transforms :— diff --git a/lib/catalog2transform.xslt b/lib/catalog2transform.xslt index 2b5c417..04c38f9 100644 --- a/lib/catalog2transform.xslt +++ b/lib/catalog2transform.xslt @@ -389,7 +389,7 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one <xslt:template match="text()" mode="书社:header"/> <xslt:template match="text()" mode="书社:footer"/> <xslt:template match="text()" mode="书社:metadata"/> - <xslt:output method="xml" encoding="UTF-8" cdata-section-elements="html:script html:style html:textarea 书社:raw-text"/> + <xslt:output method="xml" encoding="UTF-8" cdata-section-elements="html:script html:style html:textarea 书社:raw-output 书社:raw-text"/> </xslt:transform> </template> <output method="xml" encoding="UTF-8"/> diff --git a/lib/serialize.xslt b/lib/serialize.xslt index 5f792ea..4c3e84e 100644 --- a/lib/serialize.xslt +++ b/lib/serialize.xslt @@ -123,7 +123,7 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one <with-param name="source" select="string($source)"/> </call-template> </template> - <template match="node()" mode="书社:serialize"> + <template match="node()" mode="书社:serialize" priority="0"> <param name="namespace" select="''"/> <param name="declare-namespaces" select="''"/> <param name="prefix-map"> diff --git a/transforms/serialization.xslt b/transforms/serialization.xslt index 09f595e..6d6dacd 100644 --- a/transforms/serialization.xslt +++ b/transforms/serialization.xslt @@ -64,4 +64,7 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one </with-param> </apply-templates> </template> + <template match="书社:raw-output" mode="书社:serialize" priority="1"> + <copy-of select=".//text()"/> + </template> </transform>