serialisation before xslt
Wednesday, 30 July 2014 · 4 messages · last reply 7 Aug 2014
M
Marc30 Jul 2014 23:48 #
Hi,
I want to transform with xslt before to output the file.
If I do a serialize on the disk, runs the xslt with saxon et write the result the space are conserved (I use chop=false to load the file in the base).
But if I transform the file in BaseX, and serialize the file after, the element are passed to the xslt indented and I lost the space at the begining and the end of element.
And other thing, if I put the "declare option db:chop 'false';" at the beginning of the XQuery, the file is indented, if I put it out (it's unuseful) the serialisation without indentation is done.
I use the 7.9 version.
CG
Christian Grün31 Jul 2014 00:00 #
Hi Marc,
We've recently worked on chopping issues in the BaseX 8.0 snapshot [1]; some of the issues that arise due to the unfortunate default setting of the chop flag [2] have been fixed there. Could you give it a try?
If the problem persists, feel free to provide us with a little, ideally self-contained example.
Best,
Christian
[1] http://files.basex.org/releases/latest/
[2] https://github.com/BaseXdb/basex/issues/913
Quoted text · Marc · 16 lines
On Wed, Jul 30, 2014 at 11:48 PM, Marc <Marc.Liste at free.fr> wrote: > Hi, > I want to transform with xslt before to output the file. > If I do a serialize on the disk, runs the xslt with saxon et write the > result the space are conserved (I use chop=false to load the file in the > base). > But if I transform the file in BaseX, and serialize the file after, the > element are passed to the xslt indented and I lost the space at the begining > and the end of element. > > > And other thing, if I put the "declare option db:chop 'false';" at the > beginning of the XQuery, the file is indented, if I put it out (it's > unuseful) the serialisation without indentation is done. > > I use the 7.9 version.
M
Marc2 Aug 2014 13:08 #
Hi,
I do tests and answer but I think my answer is not passed.
In BaseX 8, the result of an xslt transformation is always indent, else
if I put the <xsl:output indent="no", the same code in 7.9 doesn't indent.
exemple :
let $p-serialization := (<output:serialization-parameters>
<output:method value='xml'/>
<output:indent value='no'/>
<output:omit-xml-declaration value='no'/>
<output:encoding value='utf-8'/
......
file:write("f1.xml",
collection("f"),$p-serialization),
file:write("f2.xml",
xslt:transform(collection("f"),"try.xsl"),$p-serialization)with
<xsl:output encoding="UTF-8" indent="no" method="xml"/>
in try.xsl
in 8 : the f1 is space conserved, the f2.xml is indented.
in 7.9 : the f1 is space conserved, the f2 isn't indented but space not conserved
I think that it's because the file is indented before to send it to the transformer.
So at this time I have to use f1.xml and tranform it outside of BaseX.
Marc
Quoted text · Christian Grün · 35 lines
Le 31/07/2014 00:00, Christian Grün a écrit : > Hi Marc, > > We've recently worked on chopping issues in the BaseX 8.0 snapshot > [1]; some of the issues that arise due to the unfortunate default > setting of the chop flag [2] have been fixed there. Could you give it > a try? > > If the problem persists, feel free to provide us with a little, > ideally self-contained example. > > Best, > Christian > > [1] http://files.basex.org/releases/latest/ > [2] https://github.com/BaseXdb/basex/issues/913 > > > On Wed, Jul 30, 2014 at 11:48 PM, Marc <Marc.Liste at free.fr> wrote: > > Hi, > > I want to transform with xslt before to output the file. > > If I do a serialize on the disk, runs the xslt with saxon et write the > > result the space are conserved (I use chop=false to load the file in the > > base). > > But if I transform the file in BaseX, and serialize the file after, the > > element are passed to the xslt indented and I lost the space at the > begining > > and the end of element. > > > > > > And other thing, if I put the "declare option db:chop 'false';" at the > > beginning of the XQuery, the file is indented, if I put it out (it's > > unuseful) the serialisation without indentation is done. > > > > I use the 7.9 version.
CG
Christian Grün7 Aug 2014 16:01 #
Hi Marc,
It took a while, but I think I've found the culprit. Could you give it another shot and check out the new snapshot [1]?
Christian
[1] http://files.basex.org/releases/latest/
Quoted text · Marc · 70 lines
On Sat, Aug 2, 2014 at 1:08 PM, Marc <Marc.Liste at free.fr> wrote: > Hi, > I do tests and answer but I think my answer is not passed. > In BaseX 8, the result of an xslt transformation is always indent, else > if I put the <xsl:output indent="no", the same code in 7.9 doesn't indent. > exemple : > let $p-serialization := (<output:serialization-parameters> > <output:method value='xml'/> > <output:indent value='no'/> > <output:omit-xml-declaration value='no'/> > <output:encoding value='utf-8'/ > ...... > file:write("f1.xml", > collection("f"),$p-serialization), > file:write("f2.xml", > xslt:transform(collection("f"),"try.xsl"),$p-serialization) > > with > <xsl:output encoding="UTF-8" indent="no" method="xml"/> > in try.xsl > > in 8 : the f1 is space conserved, the f2.xml is indented. > in 7.9 : the f1 is space conserved, the f2 isn't indented but space not > conserved > > I think that it's because the file is indented before to send it to the > transformer. > So at this time I have to use f1.xml and tranform it outside of BaseX. > > Marc > > > Le 31/07/2014 00:00, Christian Grün a écrit : > > Hi Marc, >> >> We've recently worked on chopping issues in the BaseX 8.0 snapshot >> [1]; some of the issues that arise due to the unfortunate default >> setting of the chop flag [2] have been fixed there. Could you give it >> a try? >> >> If the problem persists, feel free to provide us with a little, >> ideally self-contained example. >> >> Best, >> Christian >> >> [1] http://files.basex.org/releases/latest/ >> [2] https://github.com/BaseXdb/basex/issues/913 >> >> >> On Wed, Jul 30, 2014 at 11:48 PM, Marc <Marc.Liste at free.fr> wrote: >> > Hi, >> > I want to transform with xslt before to output the file. >> > If I do a serialize on the disk, runs the xslt with saxon et write the >> > result the space are conserved (I use chop=false to load the file in the >> > base). >> > But if I transform the file in BaseX, and serialize the file after, the >> > element are passed to the xslt indented and I lost the space at the >> begining >> > and the end of element. >> > >> > >> > And other thing, if I put the "declare option db:chop 'false';" at the >> > beginning of the XQuery, the file is indented, if I put it out (it's >> > unuseful) the serialisation without indentation is done. >> > >> > I use the 7.9 version. >> >
Written for BaseX 7.9. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery