- From: Piez, Wendell A. (Fed) <wendell.piez@nist.gov>
- Date: Fri, 17 Jan 2025 19:23:47 +0000
- To: John Dziurlaj <john@turnout.rocks>, "xproc-dev@w3.org" <xproc-dev@w3.org>
- Message-ID: <SA9PR09MB582425E44AC782D32DF737A7FF1B2@SA9PR09MB5824.namprd09.prod.outlook.com>
John, For XML, there is a serialization setting you can use: serialization=”map{ ‘indent’: true() }’” It can go either on an output port or used directly, for example on p:store. In some cases what the processor gives is not quite what we want, in which case XSLT is warranted (but generally not output/@indent, which will have the same limitations), but ‘by hand’. Examples are not hard to find e.g. in the Github repo oscal-xproc3 – HTH, Wendell From: John Dziurlaj <john@turnout.rocks> Sent: Friday, January 17, 2025 7:10 AM To: xproc-dev@w3.org Subject: Pretty printing an XML document 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 19:23:55 UTC