1
votes

I add new line character ' ' between two string in xslt file like this:

test 
 test1

Output is just like this:

test
test1

But I want output to be just like this:

test 
 test1

Is that possible in xslt?

I think I should talking about why I want this:

the first output doesn't make effect in excel's Alt + Enter's. But when I manually edit xml like output2, it works. 
 also doesn't work.

Extra Explaination

Let's imagine 'test test1' is written inside an excel cell. When i use Alt + Enter inside this and open file with notpead++, i see this cell like this:

test
test1

In xslt file I try to replace all "newline" text with " " to make this effect. But when I open this output in notpead i see that:

test
test1

but I want output to be like that:

test
test1
2
The two are semantically identical, so why does it cause you an issue?Rowland Shaw
Maybe test 
 test1` is what you want?Thomas W
the first output doesn't make effect in excel's Alt + Enter's. But when I manually edit xml like output2, it works. 
 also doesn't work.mavera
As @Rowland alluded to, any correct XML parser should treat 
 and a literal line feed as the same character. So you shouldn't need to worry about whether your output has a literal line feed or a 
. And I don't understand what you mean by "doesn't make effect in excel's Alt + Enter's". How are you feeding the XML input into Excel?LarsH
@LarsH I added some extra note. I think it's clear now.mavera

2 Answers

2
votes

If we are manipulating some xml nodes via templates then we can implement like ...

       <xsl:template match="node">
                <xsl:text>Package: </xsl:text>
                <xsl:value-of select="childNode"/>
                <xsl:text> available from </xsl:text>
                <xsl:value-of select="OtherchildNOde"/>
                <xsl:text>&lt;br/&gt; </xsl:text>
        </xsl:template>

so main thing is [ <br/> ]. we can use p tag instead of br tag also.

3
votes

Try something like this:-

<xsl:text>test &#10; test1 </xsl:text>