We're using Apache FOP 1.1 with XSLT to generate a PDF for printing. Our software is creating the XML correctly, and passing this directly to the FOP transformer. We are not saving anything to file so the use of transformer properties to indent the XML is not going to help here.
Basically our XML generator creates an XML document that looks like this:
<document><list><item>1</item><item>2</item><item>3</item></list></document>
and our XSLT has a bit that takes each item
child of the list
node and is suppose to print them out with a space in between. Something like this:
<!DOCTYPE xsl:stylesheet [
<!ENTITY nbsp '<xsl:text xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> </xsl:text>'>
]>
<xsl:output method="xml" version="1.0" encoding="utf-8" indent="yes" />
<xsl:template match="list">
<fo:inline>Items: </fo:inline>
<xsl:for-each select="item">
<xsl:value-of select="./text()"/>
</xsl:for-each>
</xsl:template>
At the very top of the XSLT document I've already told it what the entity
is so that shouldn't be the problem. The problem is that when the file is generated the items instead of showing up as Items: 1 2 3
are showing up as Items: 123
. The only thing I can find that seems to fix the problem is when I've generated the XML then transform it to a String where the document would now look like this:
<document>
<list>
<item>1</item>
<item>2</item>
<item>3</item>
</list>
</document>
Does the XSLT output the list correctly. So what I would like to do is add a newline node after each item in the list via the DOM, without having to first transform it and save it to a file. Is this possible?
UPDATE! I would like to apologize to all those who helped. The correct answer was given, but since I was working on the wrong portion of the template, I wasn't seeing the correction working. Yes as you noted I didn't post the entire template, that's due to its nature and source. Some years ago I started the template and had it working, and later another developer made changes to the template and stopped using the sub-template where I was originally doing the work. So when I came back to it I was of course working where I thought it was working, and was wondering why I wasn't seeing the changes.
Thanks for the support in this. This issue is solved.
 
? This character is not a newline, it is a non-breaking space: fileformat.info/info/unicode/char/00a0/index.htm. – Mathias Müller 
is not a newline. What I want is a space a simple space between the items. However, when the XML doesn't have a newline then the space ( 
) is not generated. – JRSofty