|
View:
New views
6 Messages
—
Rating Filter:
Alert me
|
|
|
xml:space or nothi list,
this is an more philosophical thought/question. i'm tested some docbook documents and playing with some custom xslts. problem is indentation and strip-space. with my xslt i need to strip all white space between non mixed content elements. problem with the following snippet: <para><emphasis>em1</emphasis> <emphasis>em2</emphasis></para> with <xsl:strip-space elements="*"/> this is transformed to: <para><emphasis>em1</emphasis><emphasis>em2</emphasis></para> which is obviously not what i want. with: <para><emphasis>em1</emphasis> x <emphasis>em2</emphasis></para> everything works fine, whitespace is preserved. i know how to get around the limitation with: <xsl:preserve-space elements="para"/> in this case i have to add any mixed content element to the list, i.e. reading the whole dtd checking/adding every element. wouldnt it be better to add an fixed attribute to any mixed content element like: xml:space CDATA #FIXED "preserve" this would help not only with xslt transformation also with pretty print functions (assumed the dtd is interpreted). and would make clear how to handle the current element. i'm not assuming that this is added in near future, i would be more interested if this idea was discussed. and/or if this method causes any problems with custom dtds. hope this question is fitting into the list topic! all the best, gregor --------------------------------------------------------------------- To unsubscribe, e-mail: docbook-unsubscribe@... For additional commands, e-mail: docbook-help@... |
|
|
Re: xml:space or notHi Gregor,
I'm not sure it is appropriate to add xml:space="preserve" to all mixed content elements. That attribute tells applications to preserve *all* white space. Wouldn't that have the unintended consequence of preserving indents and line breaks within a para in its formatted output? The default behavior in XSL-FO is to collapse multiple white space characters into a single space, giving paragraphs the nice formatted flow. If a stylesheet encounters an element with xml:space="preserve", that should override the default behavior if the processor were behaving correctly, no? Bob Stayton Sagehill Enterprises bobs@... ----- Original Message ----- From: "gregor FELLENZ" <gf_public@...> To: <docbook@...> Sent: Wednesday, September 23, 2009 6:17 AM Subject: [docbook] xml:space or not > hi list, > > this is an more philosophical thought/question. i'm tested some docbook > documents and playing with some custom xslts. > > problem is indentation and strip-space. > > with my xslt i need to strip all white space between non mixed content > elements. > > problem with the following snippet: > <para><emphasis>em1</emphasis> <emphasis>em2</emphasis></para> > > with <xsl:strip-space elements="*"/> this is transformed to: > <para><emphasis>em1</emphasis><emphasis>em2</emphasis></para> > > which is obviously not what i want. with: > <para><emphasis>em1</emphasis> x <emphasis>em2</emphasis></para> > > everything works fine, whitespace is preserved. > > i know how to get around the limitation with: > <xsl:preserve-space elements="para"/> > > in this case i have to add any mixed content element to the list, i.e. > reading the whole dtd checking/adding every element. > > wouldnt it be better to add an fixed attribute to any mixed content > element like: > xml:space CDATA #FIXED "preserve" > > this would help not only with xslt transformation also with pretty print > functions (assumed the dtd is interpreted). and would make clear how to > handle the current element. > > i'm not assuming that this is added in near future, i would be more > interested if this idea was discussed. and/or if this method causes any > problems with custom dtds. > > hope this question is fitting into the list topic! > > all the best, > gregor > > --------------------------------------------------------------------- > To unsubscribe, e-mail: docbook-unsubscribe@... > For additional commands, e-mail: docbook-help@... > > > --------------------------------------------------------------------- To unsubscribe, e-mail: docbook-unsubscribe@... For additional commands, e-mail: docbook-help@... |
|
|
Re: xml:space or nothi bob,
i agree that unintended white space would represented. but i want to avoid unintended whitespace. i.e. a tool with indentation function does produce bad renderign results. my example, to be correct: the slightly changed example does not work with xsl-fo either: this line: <para><emphasis>em1 </emphasis><emphasis>em2</emphasis></para> indentation with spy, oxygen (or xslt indent="yes") results in: <para> <emphasis>em1 </emphasis> <emphasis>em2</emphasis> </para> this produces with antenna house: em1 em2 ^^ two spaces. in theory the xml:space attribute should fix the problem. in practise oxygen ignores the attribute. but anyway, in theory i could avoid the situation above. all the best, gregor On Monday 28 September 2009 18:42:29 Bob Stayton wrote: > Hi Gregor, > I'm not sure it is appropriate to add xml:space="preserve" to all mixed > content elements. That attribute tells applications to preserve *all* white > space. Wouldn't that have the unintended consequence of preserving indents > and line breaks within a para in its formatted output? > The default > behavior in XSL-FO is to collapse multiple white space characters into a > single space, giving paragraphs the nice formatted flow. If a stylesheet > encounters an element with xml:space="preserve", that should override the > default behavior if the processor were behaving correctly, no? > > Bob Stayton > Sagehill Enterprises > bobs@... > > > ----- Original Message ----- > From: "gregor FELLENZ" <gf_public@...> > To: <docbook@...> > Sent: Wednesday, September 23, 2009 6:17 AM > Subject: [docbook] xml:space or not > > > hi list, > > > > this is an more philosophical thought/question. i'm tested some docbook > > documents and playing with some custom xslts. > > > > problem is indentation and strip-space. > > > > with my xslt i need to strip all white space between non mixed content > > elements. > > > > problem with the following snippet: > > <para><emphasis>em1</emphasis> <emphasis>em2</emphasis></para> > > > > with <xsl:strip-space elements="*"/> this is transformed to: > > <para><emphasis>em1</emphasis><emphasis>em2</emphasis></para> > > > > which is obviously not what i want. with: > > <para><emphasis>em1</emphasis> x <emphasis>em2</emphasis></para> > > > > everything works fine, whitespace is preserved. > > > > i know how to get around the limitation with: > > <xsl:preserve-space elements="para"/> > > > > in this case i have to add any mixed content element to the list, i.e. > > reading the whole dtd checking/adding every element. > > > > wouldnt it be better to add an fixed attribute to any mixed content > > element like: > > xml:space CDATA #FIXED "preserve" > > > > this would help not only with xslt transformation also with pretty print > > functions (assumed the dtd is interpreted). and would make clear how to > > handle the current element. > > > > i'm not assuming that this is added in near future, i would be more > > interested if this idea was discussed. and/or if this method causes any > > problems with custom dtds. > > > > hope this question is fitting into the list topic! > > > > all the best, > > gregor > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: docbook-unsubscribe@... > > For additional commands, e-mail: docbook-help@... -- reclaim your net - http://tor.eff.org enforce privacy - http://www.gnupg.org pgp key id: 5E7CC4DF Please note that according to the German law on data retention, information on every electronic information exchange with me is retained for a period of six months. Vorratsdatenfrei erreichbar unter: https://www.awxcnx.de/grefel.msg --------------------------------------------------------------------- To unsubscribe, e-mail: docbook-unsubscribe@... For additional commands, e-mail: docbook-help@... |
|
|
Re: xml:space or notgregor FELLENZ wrote:
> i agree that unintended white space would represented. but i want to avoid > unintended whitespace. i.e. a tool with indentation function does produce bad > renderign results. my example, to be correct: the slightly changed example > does not work with xsl-fo either: > > this line: > <para><emphasis>em1 </emphasis><emphasis>em2</emphasis></para> > > indentation with spy, oxygen (or xslt indent="yes") results in: > <para> > <emphasis>em1 </emphasis> > <emphasis>em2</emphasis> > </para> On oXygen you can control identing and whitespace preservation on element basis in Options -> Editor -> Format -> XML. Jirka -- ------------------------------------------------------------------ Jirka Kosek e-mail: jirka@... http://xmlguru.cz ------------------------------------------------------------------ Professional XML consulting and training services DocBook customization, custom XSLT/XSL-FO document processing ------------------------------------------------------------------ OASIS DocBook TC member, W3C Invited Expert, ISO JTC1/SC34 member ------------------------------------------------------------------ |
|
|
Re: xml:space or notHi Gregor,
gregor FELLENZ wrote: > [...] > > in theory the xml:space attribute should fix the problem. in practise oxygen > ignores the attribute. but anyway, in theory i could avoid the situation > above. > [...] oXygen does not ignore xml:space. It will be great if you can provide an example to show exactly the issue you had when using xml:space. Best Regards, George -- George Cristian Bina <oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger http://www.oxygenxml.com --------------------------------------------------------------------- To unsubscribe, e-mail: docbook-unsubscribe@... For additional commands, e-mail: docbook-help@... |
|
|
Re: xml:space or nothi george,
this was not clear in my post. oxygen (here version 10.2) does ignore fixed xml:space attributes declared within a dtd. a literally attribute is interpreted. the following dtd: <!ELEMENT root (p) > <!ELEMENT p (#PCDATA | em)* > <!ATTLIST p xml:space CDATA #FIXED "preserve"> <!ELEMENT em (#PCDATA)> validates this document: <!DOCTYPE root SYSTEM "ex.dtd"> <root> <p><em>em </em><em>text</em></p> </root> but oxygen indents the <p>-element. solution: you have to add the attribute to your instance. regards, gregor George Cristian Bina schrieb: > Hi Gregor, > > gregor FELLENZ wrote: >> [...] >> >> in theory the xml:space attribute should fix the problem. in practise >> oxygen ignores the attribute. but anyway, in theory i could avoid the >> situation above. [...] > > oXygen does not ignore xml:space. It will be great if you can provide an > example to show exactly the issue you had when using xml:space. > > Best Regards, > George --------------------------------------------------------------------- To unsubscribe, e-mail: docbook-unsubscribe@... For additional commands, e-mail: docbook-help@... |
| Free embeddable forum powered by Nabble | Forum Help |