Re: [xsl] Initial whitespace in PI from XSLT, main body

Subject: Re: [xsl] Initial whitespace in PI from XSLT, main body
From: "Martin Honnen martin.honnen@xxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Sat, 7 May 2022 21:45:37 -0000
On 07.05.2022 23:14, Bauman, Syd s.bauman@xxxxxxxxxxxxxxxx wrote:
> _Writing_
> But what if I try to /write/ a PI whose string value starts with one
> or more whitespace characters?
> First, we know the processor is *required* to write out one or more
> whitespace characters between the PITarget and the value string. I
> presume (without knowing for sure) that the processor is welcome to
> use whatever set of whitespace characters it wants to separate the
> PITarget from the rest when it serializes a PI. (I have never seen nor
> heard of a processor that uses anything other than a single space
> (U+0020) character, myself.) I further suspect that most processors
> would choose to not use any whitespace characters when serializing a
> PI that does not have a value string.
> But if I am explicitly giving the processor a string to use as the
> value of the PI that starts with space, I sort of expect that string,
> including the leading space, to appear in the output after whatever
> space the processor normally uses to separate a PITarget from a value
> string. And that is the behavior I get from xsltproc.[B]
> But it is not the behavior I get from Saxon.[C]
> So is Saxon in error, or is xsltproc in error, or is the spec
> ambiguous and either behavior is OK, or something else?

The relevant XSLT 3 spec section is and clearly
says "6. In the case of|xsl:processing-instruction|
<>, any
leading spaces in the resulting string are removed."

Current Thread