preserve format

Here should go questions about transforming XML with XSLT and FOP.
Oleksii
Posts: 54
Joined: Wed Jul 19, 2017 6:04 pm
Location: Austria
Contact:

preserve format

Post by Oleksii » Fri Mar 13, 2020 12:00 pm

Hi,

when using refactoring in oXygen, the formatting is preserved, .e. g. the following example remains the same:

Code: Select all

<zone data="#m1_k589_" lrx="469" lry="1125" type="measure" ulx="321" uly="204" xml:id="zoneOf_measure1"/>
When using an external XSLT and applying it with the transformation scenario, the formatting is changed, the output looks like this:

Code: Select all

<zone data="#m1_k589_"
                  lrx="469"
                  lry="1125"
                  type="measure"
                  ulx="321"
                  uly="204"
                  xml:id="zoneOf_measure1"/>
Is this an XSLT- or oXygen-specific option and is it possible to implement it for XSLT transformations?
Thanks.

adrian
Posts: 2648
Joined: Tue May 17, 2005 4:01 pm

Re: preserve format

Post by adrian » Wed Mar 25, 2020 5:42 pm

Hello,

The output of an XSLT transformation depends on the XSLT transformer being used and how that transformer is configured to serialize the output. Generally speaking, even an XSLT that just copies the input XML to the output, may have an output with significant changes in the formatting from the input.

What refactoring actions did you use in Oxygen?
Many of the refactoring actions are actually implemented using XQuery Update, not necessarily XSLT.

Regards.
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com

Oleksii
Posts: 54
Joined: Wed Jul 19, 2017 6:04 pm
Location: Austria
Contact:

Re: preserve format

Post by Oleksii » Fri Apr 17, 2020 3:51 pm

Hi Adrian
most often I use "Attributes" and sometimes "Elements". Normally, I use Saxon PE 9.8, is it possible to configure it that way in oXygen?
best regards

adrian
Posts: 2648
Joined: Tue May 17, 2005 4:01 pm

Re: preserve format

Post by adrian » Fri Apr 17, 2020 4:55 pm

Hi,

It's not possible to configure an XSLT transformation that automatically detects the input XML formatting and keeps the same formatting in the output.
You can manually adjust the formatting/serialization options within the XSLT in the xsl:stylesheet/xsl:output element so that it mimics the formatting of the input XML:
e.g.

Code: Select all

<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:saxon="http://saxon.sf.net/">
    <xsl:output method="xml" indent="yes" saxon:indent-spaces="2"/>
Saxon allows fine-tuning the serialization with some extra parameters.
See Saxon - Additional serialization parameters

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com

Post Reply