xsl:message without linefeed?

J

Johannes Busse

Hello,

I use saxon 6.5.3. under SuSE 9.1.
In my stylesheet I give out messages like

<xsl:message>
<xsl:value-of select="$myId" />
<xsl:text> | </xsl:text>
</xsl:message>

my problem: saxon adds a newline behind each message;
instead of getting

3d2345 | 3d098 | 3d09568 | ...

I get

3d2345 |
3d098 |
3d09568 |
...

This behavior semms to differ
from the saxon documentation, c.f.
http://saxon.sourceforge.net/saxon6.5.3/xsl-elements.html#xsl:message

any hint?

thank you, johannes
www.jbusse.de
 
D

David Carlisle

the linefeed isn't coming from the code you showed, it is presumably
coming from the variable $myId the definition of which you didn't show.
You could get rid of it with:

<xsl:value-of select="normalize-space($myId)" />
 
J

Johannes Busse

the linefeed isn't coming from the code you showed,

ok: you agree there should be no linefeed?
it is presumably
coming from the variable $myId the definition of which you didn't show.
You could get rid of it with:

<xsl:value-of select="normalize-space($myId)" />
if you were right, the " | " in my example output
would be moved to the new line; but is is still
on the right line.

Have a look at the follwing example:

------- message.xsl --------
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.1">
<xsl:template match="/">
<xsl:message><xsl:text>Adam</xsl:text></xsl:message>
<xsl:message><xsl:text>Eve</xsl:text></xsl:message>
</xsl:template>
</xsl:stylesheet>
---------- EOF message.xsl ----------

This stylesheet produces the following output:

name@nirwana:~/public_html/test> saxon empty.xml message.xsl RETURN
Adam
Eve
<?xml version="1.0" encoding="utf-8"?>name@nirwana:~/public_html/test>

maybe it is a problem of the terminal window?
(I am using xterm with fvwm2, the SuSE standard if you
do not want to use KDE.)

johannes
 
D

David Carlisle

Oh they are different xsl:messages (That was implied by your original
post but I missed it, sorry)

yes saxon puts each new message on a new line, you can suppress
"internal" line breaks from xslt but I don't think you can do anything
about the newline that is used at the start of each message from the
command line at the saxon level, although of course since you are using
a linux shell you could redirect stderr (which is where xsl:message is
going) through sed or perl or whatever and reformat it any way you want.



your posted input file (e.xsl) run on itself produces:

saxon e.xsl e.xsl 2>&1 | sed -e :a -e "/$/N;s/\n//;ta" -
AdamEve


david

blame google for the sed hack:)
 
J

Johannes Busse

hi,
I don't think you can do anything
about the newline that is used at the start of each message from the
command line at the saxon level,

thank you, good to know that it is not my fault
do find out the solution
saxon e.xsl e.xsl 2>&1 | sed -e :a -e "/$/N;s/\n//;ta" -
AdamEve
blame google for the sed hack:)

That's in deed a hack. I will keep it in mind!
thank you for your help!

johannes
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,999
Messages
2,570,243
Members
46,836
Latest member
login dogas

Latest Threads

Top