Java Mailing List Archive

http://www.junlu.com/

Home » JDOM Projects »

[jdom-interest] additional spaces in complex elements using
 PrettyFormat

SoTaNeZ

2013-01-15

Replies: Find Java Web Hosting

Author LoginPost Reply
Hello.

I have some complex elements in which their texts are mixed with some HTML markup that I treat as XML elements. For example:

------------------------------------------------------
    <paragraph align="justified">
      According to the normalized curve A (LA
      <sub>eq inter</sub>
      ) the values...
    </paragraph >
------------------------------------------------------

The above example is in PrettyFormat.

My intention is to use an XSL to transform this text to HTML, keeping the HTML representation, so using "xsl:copy-of" I can copy the whole paragraph as is.
The problem is that the XML elements inserted between the text are represented in a new line, so the XLT transformation adds both white spaces before and after these elements in the HTML output:

------------------------------------------------------
According to the normalized curve A (LA eq inter ) the values...
------------------------------------------------------

when the output I want should be:

------------------------------------------------------
According to the normalized curve A (LAeq inter) the values...
------------------------------------------------------

I cannot use the CompactFormat, because I need these XMLs to be readable by humans.

The problem is solved if I manually place these inner XML elements in the same line with the rest of the text:

------------------------------------------------------
    <paragraph align="justified">
      According to the normalized curve A (LA<sub>eq inter</sub>) the values...
    </paragraph >
------------------------------------------------------

Is there a way to tell JDOM to format complex XML elements (those having text and other elements) this way, or maybe other workarounds?

I prefer to avoid post-processing of the outputted XMLs files...

Thank you very much.

_______________________________________________
To control your jdom-interest membership:
http://www.jdom.org/mailman/options/jdom-interest/youraddr@(protected)
©2008 junlu.com - Jax Systems, LLC, U.S.A.