xsl:message without linefeed?

Discussion in 'XML' started by Johannes Busse, Dec 7, 2004.

  1. 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
    Johannes Busse, Dec 7, 2004
    #1
    1. Advertising

  2. 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)" />
    David Carlisle, Dec 7, 2004
    #2
    1. Advertising

  3. > 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
    Johannes Busse, Dec 7, 2004
    #3
  4. 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:)
    David Carlisle, Dec 7, 2004
    #4
  5. 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
    Johannes Busse, Dec 8, 2004
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. sck10
    Replies:
    1
    Views:
    1,910
    Steven Cheng[MSFT]
    Mar 23, 2006
  2. Frogleg

    <div> withut linefeed?

    Frogleg, Jul 31, 2005, in forum: HTML
    Replies:
    7
    Views:
    1,040
    Toby Inkster
    Jul 31, 2005
  3. Matthias

    Linefeed in xsl:fo with FOP

    Matthias, Aug 8, 2006, in forum: XML
    Replies:
    0
    Views:
    867
    Matthias
    Aug 8, 2006
  4. Tor Inge Rislaa

    DataList removes the linefeed

    Tor Inge Rislaa, Nov 8, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    313
    Marina Levit [MVP]
    Nov 8, 2006
  5. guycasome
    Replies:
    1
    Views:
    345
    guycasome
    Aug 24, 2007
Loading...

Share This Page