Why no indent when use XProc to execute XSLT?

Having trouble installing Oxygen? Got a bug to report? Post it all here.
serioadamo97
Posts: 22
Joined: Tue Oct 17, 2017 5:05 pm

Why no indent when use XProc to execute XSLT?

Post 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.
adrian
Posts: 2879
Joined: Tue May 17, 2005 4:01 pm

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

Post 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
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
serioadamo97
Posts: 22
Joined: Tue Oct 17, 2017 5:05 pm

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

Post by serioadamo97 »

It works, thanks.
Post Reply