Page 1 of 1

Why no indent when use XProc to execute XSLT?

Posted: Mon Feb 26, 2018 10:37 pm
by serioadamo97
XSLT file (test-xproc.xsl):

Code: Select all


<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes="xs"
version="2.0">
<xsl:output method="xml" indent="yes"/>
<xsl:template name="main">
<AAA>
<BBB>
<CCC>
</CCC>
</BBB>
</AAA>
</xsl:template>
</xsl:stylesheet>
XProc file (test-xproc.xpl):

Code: Select all


<?xml version="1.0" encoding="UTF-8"?>
<p:pipeline xmlns:p="http://www.w3.org/ns/xproc"">
<p:xslt template-name="main">
<p:input port="stylesheet">
<p:document href="./test-xproc.xsl"/>
</p:input>
</p:xslt>
</p:pipeline>
The result of XProc is <AAA><BBB><CCC/></BBB></AAA>, no indent.

Re: Why no indent when use XProc to execute XSLT?

Posted: Fri Mar 02, 2018 1:49 pm
by adrian
HI,

For pipelines XProc has its own serialization that overrides the one of the XSLT processor.
Use p:serialization to specify the serialization rules for your pipeline.
To get the same result as transforming the XSL directly, use:

Code: Select all

<p:serialization port="result" method="xml" indent="true" omit-xml-declaration="false"/>
Regards,
Adrian

Re: Why no indent when use XProc to execute XSLT?

Posted: Sun Mar 04, 2018 4:14 pm
by serioadamo97
It works, thanks.