문제

I'm using a Java Transformer to convert XML into HTML. When I display the output, everywhere I had a newline string literal delimiter of "\n" in a field, there's simply a space. The only suggestion I've been able to find is:

transformer.setOutputProperty(OutputKeys.INDENT, "yes");

which didn't work. I cannot find anything in the JavaDocs for the TransformerFactory, or Transformer classes that addresses this issue. Any suggestions?

도움이 되었습니까?

해결책

I found the issue. The XSL that was specified for the Transformer included a call to the "normalize-space" function. See: http://www.xsltfunctions.com/xsl/fn_normalize-space.html

It was removing the newline and replacing it with a single space, as documented.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top