AW: Pretty printing an XML document

You can use @serialization on p:store.


Von: John Dziurlaj <john@turnout.rocks>
Gesendet: Freitag, 17. Januar 2025 13:10
An: xproc-dev@w3.org
Betreff: Pretty printing an XML document

Sie erhalten nicht häufig E-Mails von john@turnout.rocks<mailto:john@turnout.rocks>. Erfahren Sie, warum dies wichtig ist<https://aka.ms/LearnAboutSenderIdentification>
Suppose I want to pretty-print an XML document using XProc. Of course I can use XSLT:

<?xml version="1.0" encoding="UTF-8"?>
<p:declare-step xmlns:p="http://www.w3.org/ns/xproc" name="pipeline"
    version="3.0">
    <p:input port="source" primary="true" />
    <p:output port="result" primary="true" />
    <p:xslt>
        <p:with-input port="stylesheet">
            <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="3.0">
                <!-- Output formatted XML -->
                <xsl:output method="xml" indent="yes" />
                <!-- Identity transformation template -->
                <xsl:template match="@* | node()">
                    <xsl:copy>
                        <xsl:apply-templates select="@* | node()" />
                    </xsl:copy>
                </xsl:template>
            </xsl:stylesheet>
        </p:with-input>
    </p:xslt>
</p:declare-step>

But this feels like a kludge. Is there an XProc3 native way?

John Dziurłaj /d͡ʑurwaj/

Received on Friday, 17 January 2025 17:26:40 UTC