Problem with attribute parsing?

Monday, 6 April 2020 · 2 messages
PV
Peter Villadsen6 Apr 2020 00:21 #
Hello I was doing some experiments and I ended up with this:
let $c := <Class Source='{ttt'></Class>
return $c/@Source
When this is compiled in the BaseX GUI app, an error message ensues: Error: Stopped at ... /file3, 1/30: [XPST0003] Expecting '}', found '''. Query: let $c := <Class Source='{ttt'></Class> return $c/@Source Query plan: <QueryPlan compiled="false" updating="false"/> Surely that is not correct? If I add a } there, everything is fine:
let $c := <Class Source='{ttt}'></Class>
return $c/@Source
I don't think there is an XML requirement forcing escaping start brace ('{') inside an attribute value? I know that XQuery supports <X A='{...}' /> where the inside of the {} is evaluated to give the value for the A attribute, but the example above is not XQuery, just an XML literal. I am sure I would have noticed this if it were a general problem. Best Regards Peter Villadsen Principal Architect Microsoft Business Applications Group
LQ
Liam R. E. Quin6 Apr 2020 02:26 #
Quoted text · Peter Villadsen · 6 lines
On Sun, 2020-04-05 at 22:21 +0000, Peter Villadsen wrote: > Hello > > I was doing some experiments and I ended up with this: > > let $c := <Class Source='{ttt'></Class>
This is an error because the braces surround expresions: <Class Source='{ concat("t", "ttt") }'> would work. Similarly you can write <boy>{ concat('dirt', 'noise') }</boy> of course. Liam
-- Liam Quin, https://www.delightfulcomputing.com/ Available for XML/Document/Information Architecture/XSLT/ XSL/XQuery/Web/Text Processing/A11Y training, work & consulting. Barefoot Web-slave, antique illustrations: http://www.fromoldbooks.org

⚡Generated with XQuery