[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Initial whitespace in PI from XSLT, main body

Subject: Re: Initial whitespace in PI from XSLT, main body
From: "Bauman, Syd s.bauman@xxxxxxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Sat, 7 May 2022 22:23:46 -0000
Re:  Initial whitespace in PI from XSLT
MH> The relevant XSLT 3 spec section is
https://www.w3.org/TR/xslt-30/#constructing-simple-content<https://nam12.safe
links.protection.outlook.com/?url=https%3A%2F%2Fwww.w3.org%2FTR%2Fxslt-30%2F%
23constructing-simple-content&data=05%7C01%7Cs.bauman%40northeastern.edu%7Cf7
d75cb09c2b4004a57f08da3072f8d5%7Ca8eec281aaa34daeac9b9a398b9215e7%7C0%7C0%7C6
37875568061834037%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzI
iLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=IvUUGrl1Pg7%2Bms%2FUToo
gBhl8idaun40GEvxAf%2Bn5aCk%3D&reserved=0> and clearly says "6. In the case of
xsl:processing-instruction<https://nam12.safelinks.protection.outlook.com/?ur
l=https%3A%2F%2Fwww.w3.org%2FTR%2Fxslt-30%2F%23element-processing-instruction
&data=05%7C01%7Cs.bauman%40northeastern.edu%7Cf7d75cb09c2b4004a57f08da3072f8d
5%7Ca8eec281aaa34daeac9b9a398b9215e7%7C0%7C0%7C637875568061990277%7CUnknown%7
CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%
3D%7C3000%7C%7C%7C&sdata=IcC2BVnqQQf0D5o4zlusIcLtGpzwNvU%2BtA%2Foxtuc9Xk%3D&r
eserved=0>, any leading spaces in the resulting string are removed."

DN>
https://www.w3.org/TR/xslt-30/#constructing-simple-content<https://nam12.safe
links.protection.outlook.com/?url=https%3A%2F%2Fwww.w3.org%2FTR%2Fxslt-30%2F%
23constructing-simple-content&data=05%7C01%7Cs.bauman%40northeastern.edu%7C9d
b73cd3a721407df65b08da3073d667%7Ca8eec281aaa34daeac9b9a398b9215e7%7C0%7C0%7C6
37875571320678621%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzI
iLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=skqprH7CYK0yWW4psy8dTVb
70sX9dXmWCVrgC4OyIKY%3D&reserved=0> : " .  .  . 6. In the case of
xsl:processing-instruction<https://nam12.safelinks.protection.outlook.com/?ur
l=https%3A%2F%2Fwww.w3.org%2FTR%2Fxslt-30%2F%23element-processing-instruction
&data=05%7C01%7Cs.bauman%40northeastern.edu%7C9db73cd3a721407df65b08da3073d66
7%7Ca8eec281aaa34daeac9b9a398b9215e7%7C0%7C0%7C637875571320678621%7CUnknown%7
CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%
3D%7C3000%7C%7C%7C&sdata=qYVrPuaEXCFFSZ79WMJaPNnD8IJqt0ev1KDhpBVpffw%3D&reser
ved=0>, any leading spaces in the resulting string are removed."

MK> Yes, Saxon strips any leading whitespace included in the content when you
create a processing instruction using XSLT or XQuery.
MK> XQuery 3.1 mandates this in B'3.9.3.5. XSLT 3.0 also does so, in B'5.7.2.
MK> The problem is that there is no way of serializing a PI in such a way that
leading whitespace in the content round-trips when the serialised output is
re-parsed. But the serialization spec mandates that you should serialize the
XML in such a way that round-tripping works.
MK> It's unfortunate that the Data Model in B'6.5.1 doesn't state a constraint
that the content of a PI must not contain leading whitespace.
MK> XSLT 1.0 didn't say that xsl:processing-instruction should strip leading
whitespace; and XSLT 2.0 didn't explicitly list this as an incompatible
change. But then, in XSLT 1.0, there is no way of reading a processing
instruction created by the transformation other than serialization followed by
parsing, and this process loses any leading whitespace.

Thank you, gentlemen!

Seems to me, then, that Saxon is correct in stripping leading space on writing
a PI; and that xsltproc (since it is only processing XSLT 1.0) is not wrong to
include it, but will have a minor problem with this if and when it grows up to
process XSLT 3.0.

Thanks again, this has been yet another learning moment brought to you by the
XSLT community. p

XSL-List info and
archive<https://nam12.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.
mulberrytech.com%2Fxsl%2Fxsl-list&data=05%7C01%7Cs.bauman%40northeastern.edu%
7C601616d493e64c00492d08da30761864%7Ca8eec281aaa34daeac9b9a398b9215e7%7C0%7C0
%7C637875581017378461%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2l
uMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=o%2FLF7jAteBqm6gssB
F3t3KEdJVSqUNV4XdKeb%2FQxuXY%3D&reserved=0>
EasyUnsubscribe<https://nam12.safelinks.protection.outlook.com/?url=http%3A%2
F%2Flists.mulberrytech.com%2Funsub%2Fxsl-list%2F649132&data=05%7C01%7Cs.bauma
n%40northeastern.edu%7C601616d493e64c00492d08da30761864%7Ca8eec281aaa34daeac9
b9a398b9215e7%7C0%7C0%7C637875581017378461%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC
4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdat
a=4%2ByPRY41HK9Qsm5E0wPbU82HWokYmN9T1M9PBk%2B8VRQ%3D&reserved=0> (by email<>)

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.