- From: Piez, Wendell A. (Fed) <wendell.piez@nist.gov>
- Date: Fri, 17 Jan 2025 20:22:50 +0000
- To: David Cramer <david@thingbag.net>, John Dziurlaj <john@turnout.rocks>
- CC: "xproc-dev@w3.org" <xproc-dev@w3.org>
- Message-ID: <SA9PR09MB58248F0B6625DB77B2E7DCD6FF1B2@SA9PR09MB5824.namprd09.prod.outlook.com>
XProc listers – Sorry for my email latency today. I only appear to be late, really. Good algorithms for providing tag indenting exist, but they have to be written to reflect the semantics of your document type. As David says, the built-in indenting logic is good enough only for certain kinds of simple data. Regards, Wendell From: David Cramer <david@thingbag.net> Sent: Friday, January 17, 2025 12:32 PM To: John Dziurlaj <john@turnout.rocks> Cc: xproc-dev@w3.org Subject: Re: Pretty printing an XML document Once you’ve put the step in your library (maybe you name it “pretty-print” instead?), it will look very concise and readable when you use it in your pipelines: … <l:pretty-print/> … I would never use that for document-like content though—it’ll mess up whitespace. Btw., you can make that stylesheet shorter: <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="3.0"> <xsl:mode on-no-match="shallow-copy"/> <xsl:output indent="true"/> </xsl:stylesheet> Regards, David Typed wtih thmubs On Jan 17, 2025, at 11:18 AM, John Dziurlaj <john@turnout.rocks<mailto:john@turnout.rocks>> wrote: 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 20:22:56 UTC