indent parameter

Wednesday, 21 November 2012 · 4 messages · last reply 28 Jun 2013
HR
Hans-Juergen Rennau21 Nov 2012 15:41 #
Hello, it seems to me there is a couple of issues concerning the handling of indentation (serialization parameter "indent"). a) Using "indent=no" whitespace-only text nodes between element nodes are removed b) Using "indent=yes" the content of elements with xml:space="preserve" is indented, too I suppose both behaviors are in contraction to the spec ( http://www.w3.org/TR/xslt-xquery-serialization/#xml-indent ). As a particular consequence, (a) seems to preclude making an exact copy of a document (fragment) - all whitespace-only text nodes vanish. And as a consequence of (b) one has no possibility to locally protect the whitespace used in the source document, as required for example when reusing "programlisting" elements of docbook. Or did I overlook something? Kind regards, Hans-Juergen
CG
Christian Grün21 Nov 2012 15:50 #
Hi Hans-Jürgen, you may need to set the CHOP Option to false before creating a database or document [1]. Do you think this solves the problems? If no, do you have a small example that demonstrates the confusion? Christian [1] http://docs.basex.org/wiki/Startup_Options
Quoted text · Hans-Juergen Rennau · 32 lines
On Wed, Nov 21, 2012 at 3:41 PM, Hans-Juergen Rennau <hrennau at yahoo.de> wrote: > Hello, > > it seems to me there is a couple of issues concerning the handling of > indentation (serialization parameter "indent"). > > a) Using "indent=no" whitespace-only text nodes between element nodes are > removed > b) Using "indent=yes" the content of elements with xml:space="preserve" is > indented, too > > I suppose both behaviors are in contraction to the spec ( > http://www.w3.org/TR/xslt-xquery-serialization/#xml-indent ). > > As a particular consequence, (a) seems to preclude making an exact copy of a > document (fragment) - all whitespace-only text nodes vanish. > > And as a consequence of (b) one has no possibility to locally protect the > whitespace used in the source document, as required for example when reusing > "programlisting" elements of docbook. > > Or did I overlook something? > > Kind regards, > Hans-Juergen > > > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >
HR
Hans-Juergen Rennau22 Nov 2012 09:59 #
Hi Christian, thank you very much! So I had overlooked the option -w, which enables the preservation of whitespace-only text nodes. For practical purposes, I can now achieve what I need - an exact copy of a source fragment: using "-w -s indent=no". Only one issue remains: the indentation does not honour "xml:space='preserve'". Example: Input: <a xml:space="preserve"><b/></a> Call: basex -i input.xml -s indent=yes -q. Result:
<a xml:space="preserve">
  <b/>
</a>
Cordial greetings, Hans-Juergen ________________________________ Von: Christian Grün <christian.gruen at gmail.com> An: Hans-Juergen Rennau <hrennau at yahoo.de> CC: BaseX <basex-talk at mailman.uni-konstanz.de> Gesendet: 15:50 Mittwoch, 21.November 2012 Betreff: Re: [basex-talk] indent parameter Hi Hans-Jürgen, you may need to set the CHOP Option to false before creating a database or document [1]. Do you think this solves the problems? If no, do you have a small example that demonstrates the confusion? Christian [1] http://docs.basex.org/wiki/Startup_Options
CG
Christian Grün28 Jun 2013 19:21 #
Hi Hans-Jürgen, seven (wow) months ago, you noticed that our serializer did not honor the xml:space attribute. This has finally been fixed in the latest stable snapshot [1]. All the best, Christian [1] http://files.basex.org/releases/latest/ ___________________________ 2012/11/22 Hans-Juergen Rennau <hrennau at yahoo.de>:
Quoted text · Hans-Juergen Rennau · 43 lines
> Hi Christian, > > thank you very much! So I had overlooked the option -w, which enables the > preservation of whitespace-only text nodes. For practical purposes, I can > now achieve what I need - an exact copy of a source fragment: using "-w -s > indent=no". > > Only one issue remains: the indentation does not honour > "xml:space='preserve'". > > Example: > Input: > <a xml:space="preserve"><b/></a> > > Call: > basex -i input.xml -s indent=yes -q. > > Result: > <a xml:space="preserve"> > <b/> > </a> > > Cordial greetings, > Hans-Juergen > > ________________________________ > Von: Christian Grün <christian.gruen at gmail.com> > An: Hans-Juergen Rennau <hrennau at yahoo.de> > CC: BaseX <basex-talk at mailman.uni-konstanz.de> > Gesendet: 15:50 Mittwoch, 21.November 2012 > Betreff: Re: [basex-talk] indent parameter > > Hi Hans-Jürgen, > > you may need to set the CHOP Option to false before creating a > database or document [1]. Do you think this solves the problems? If > no, do you have a small example that demonstrates the confusion? > > Christian > > [1] http://docs.basex.org/wiki/Startup_Options > ___________________________ >

⚡Generated with XQuery