#193 Unwanted spaces in comments and processing instructions

v7.9
closed
5
2012-10-08
2004-03-10
Michael Kay
No

When the content of a comment or processing
instruction is generated as a sequence of text nodes, a
single space is incorrectly inserted between each text
node. This should happen only when the (new) select
attribute is used to generate the comment or PI.

Solution:

add the line

    inst.setSeparator(new StringValue

(select==null ? "" : " "));

after compileContent(inst) in the compile() methods of
XSLComment and XSLProcessingInstruction.

Test cases added: whte22 and whte23

Michael Kay

Discussion

  • Boris Stumm

    Boris Stumm - 2004-03-29

    Logged In: YES
    user_id=924525

    I have a very similar with function calls:

    <stylesheet version="2.0" xmlns="http://www.w3.org/1999/XSL/Transform" xmlns:foo="bar"> <output method="text" encoding="ISO-8859-1"/>
    <template match="/">
        <text>a</text>
        <text>b</text>
        <value-of select="foo:cmd()"/>
    </template>
    
    <function name="foo:cmd">
        <text>a</text>
        <text>b</text>
    </function>
    

    </stylesheet>

    I think this should output "abab", but what I get is "aba b"

     
  • Boris Stumm

    Boris Stumm - 2004-03-29

    Logged In: YES
    user_id=924525

    Whoopsi. I was a bit to fast. Didn't know about separator
    attribute.