xsl-list
[Top] [All Lists]

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

2022-05-07 16:45:42

On 07.05.2022 23:14, Bauman, Syd s(_dot_)bauman(_at_)northeastern(_dot_)edu 
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]
<https://bauman.zapto.org/~syd/temp/DSG/Initial_whitespace_in_PI_from_XSLT/Appendix_B_xsltproc_output.xml>
But it is not the behavior I get from Saxon.[C]
<https://bauman.zapto.org/~syd/temp/DSG/Initial_whitespace_in_PI_from_XSLT/Appendix_C_Saxon_output.xml>

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
https://www.w3.org/TR/xslt-30/#constructing-simple-content and clearly
says "6. In the case of|xsl:processing-instruction|
<https://www.w3.org/TR/xslt-30/#element-processing-instruction>, any
leading spaces in the resulting string are removed."
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--
<Prev in Thread] Current Thread [Next in Thread>