Access to the Unicode Character Database from XQuery?

Monday, 25 May 2026 · 9 messages
GS
Graydon Saunders25 May 2026 17:05 #
Hello! I am currently exploring what to do when a footnote callout, which will wind up in an xs:ID value, is something like U+2020 DAGGER; one obvious way is to use the character name. (So instead of an @id value of `Fn1` I'd have `Fndagger` or similar.) I see that the current draft of XPath 4.0 has new-since-3.0 `characters()` and `grapheme()` functions, but so far as I may tell it does not have a way to get UCD properties for a codepoint. Is there an XQuery (or BaseX) way to do this? Thanks! Graydon
MH
Martin Honnen25 May 2026 17:16 #
Quoted text · Graydon Saunders · 13 lines
On 25/05/2026 17:03, Graydon Saunders via BaseX-Talk wrote: > > I am currently exploring what to do when a footnote callout, which > will wind up in an xs:ID value, is something like U+2020 DAGGER; one > obvious way is to use the character name. (So instead of an @id value > of `Fn1` I'd have `Fndagger` or similar.) > > I see that the current draft of XPath 4.0 has new-since-3.0 > `characters()` and `grapheme()` functions, but so far as I may tell it > does not have a way to get UCD properties for a codepoint. > > Is there an XQuery (or BaseX) way to do this? >
You can call Java
declare namespace character = "java:java.lang.Character";

character:getName(0x2020)
CG
Christian Grün25 May 2026 17:26 #
You can also do: char('dagger'), char(0x2020)
Quoted text · Martin Honnen · 20 lines
Von: Martin Honnen via BaseX-Talk <basex-talk at mailman.uni-konstanz.de> Gesendet: Montag, 25. Mai 2026 17:16 An: basex-talk at mailman.uni-konstanz.de Betreff: [basex-talk] Re: Access to the Unicode Character Database from XQuery? On 25/05/2026 17:03, Graydon Saunders via BaseX-Talk wrote: > > I am currently exploring what to do when a footnote callout, which > will wind up in an xs:ID value, is something like U+2020 DAGGER; one > obvious way is to use the character name. (So instead of an @id value > of `Fn1` I'd have `Fndagger` or similar.) > > I see that the current draft of XPath 4.0 has new-since-3.0 > `characters()` and `grapheme()` functions, but so far as I may tell it > does not have a way to get UCD properties for a codepoint. > > Is there an XQuery (or BaseX) way to do this? > You can call Java declare namespace character = "java:java.lang.Character"; character:getName(0x2020)
GS
Graydon Saundersin reply to Martin Honnen, 25 May 2026, 17:1625 May 2026 17:39 #
Thank you, Martin! That looks like it will let me handle more or less anything if the pubs team decides to start marching through Unicode for footnote callouts.
Quoted text · Martin Honnen · 23 lines
On Mon, May 25, 2026, at 11:16, Martin Honnen via BaseX-Talk wrote: > > On 25/05/2026 17:03, Graydon Saunders via BaseX-Talk wrote: > > > > I am currently exploring what to do when a footnote callout, which > > will wind up in an xs:ID value, is something like U+2020 DAGGER; one > > obvious way is to use the character name. (So instead of an @id value > > of `Fn1` I'd have `Fndagger` or similar.) > > > > I see that the current draft of XPath 4.0 has new-since-3.0 > > `characters()` and `grapheme()` functions, but so far as I may tell it > > does not have a way to get UCD properties for a codepoint. > > > > Is there an XQuery (or BaseX) way to do this? > > > > You can call Java > > declare namespace character = "java:java.lang.Character"; > > character:getName(0x2020) > >
GS
Graydon Saundersin reply to Christian Grün, 25 May 2026, 17:2625 May 2026 17:47 #
Hi Christian, Curiously, char('dagger') gives me † and char('Dagger') gives me ‡. char('DAGGER') returns an error: "[FOCH0005] Invalid name, glyph or codepoint value: DAGGER (similar: Dagger)." None of the case permutations of character:getName(0x2021) which is "DOUBLE DAGGER" are acceptable to `char()`. The numeric, 0x2021, works. (The optimizer happily reduces all of these that work to string literals.) I'm using BaseX 12.3, if that should be relevant. Thanks! Graydon
Quoted text · Christian Grün · 35 lines
On Mon, May 25, 2026, at 11:26, Christian Grün via BaseX-Talk wrote: > You can also do: > > char('dagger'), > char(0x2020) > > > ________________________________________ > Von: Martin Honnen via BaseX-Talk <basex-talk at mailman.uni-konstanz.de> > Gesendet: Montag, 25. Mai 2026 17:16 > An: basex-talk at mailman.uni-konstanz.de > Betreff: [basex-talk] Re: Access to the Unicode Character Database from XQuery? > > > On 25/05/2026 17:03, Graydon Saunders via BaseX-Talk wrote: > > > > I am currently exploring what to do when a footnote callout, which > > will wind up in an xs:ID value, is something like U+2020 DAGGER; one > > obvious way is to use the character name. (So instead of an @id value > > of `Fn1` I'd have `Fndagger` or similar.) > > > > I see that the current draft of XPath 4.0 has new-since-3.0 > > `characters()` and `grapheme()` functions, but so far as I may tell it > > does not have a way to get UCD properties for a codepoint. > > > > Is there an XQuery (or BaseX) way to do this? > > > > You can call Java > > declare namespace character = "java:java.lang.Character"; > > character:getName(0x2020) > >
CG
Christian Grün25 May 2026 17:54 #
Hi Graydon, The spec expects the argument to be resolved against the characters defined in the HTML Living Standard [1,2]. The entity for the double-dagger character seems to be “ddagger”. Cheers, Christian [1] https://qt4cg.org/specifications/xpath-functions-40/Overview.html#func-char [2] https://html.spec.whatwg.org/#named-character-references
Quoted text · Graydon Saunders · 34 lines
Von: Graydon Saunders <graydonish at fastmail.com> Gesendet: Montag, 25. Mai 2026 17:46 An: Christian Grün; BaseX; Martin Honnen Betreff: Re: [basex-talk] Re: Access to the Unicode Character Database from XQuery? Hi Christian, Curiously, char('dagger') gives me † and char('Dagger') gives me ‡. char('DAGGER') returns an error: "[FOCH0005] Invalid name, glyph or codepoint value: DAGGER (similar: Dagger)." None of the case permutations of character:getName(0x2021) which is "DOUBLE DAGGER" are acceptable to `char()`. The numeric, 0x2021, works. (The optimizer happily reduces all of these that work to string literals.) I'm using BaseX 12.3, if that should be relevant. Thanks! Graydon On Mon, May 25, 2026, at 11:26, Christian Grün via BaseX-Talk wrote: You can also do: char('dagger'), char(0x2020) Von: Martin Honnen via BaseX-Talk <basex-talk at mailman.uni-konstanz.de<mailto:basex-talk at mailman.uni-konstanz.de>> Gesendet: Montag, 25. Mai 2026 17:16 An: basex-talk at mailman.uni-konstanz.de<mailto:basex-talk at mailman.uni-konstanz.de> Betreff: [basex-talk] Re: Access to the Unicode Character Database from XQuery? On 25/05/2026 17:03, Graydon Saunders via BaseX-Talk wrote: > > I am currently exploring what to do when a footnote callout, which > will wind up in an xs:ID value, is something like U+2020 DAGGER; one > obvious way is to use the character name. (So instead of an @id value > of `Fn1` I'd have `Fndagger` or similar.) > > I see that the current draft of XPath 4.0 has new-since-3.0 > `characters()` and `grapheme()` functions, but so far as I may tell it > does not have a way to get UCD properties for a codepoint. > > Is there an XQuery (or BaseX) way to do this? > You can call Java declare namespace character = "java:java.lang.Character"; character:getName(0x2020)
GS
Graydon Saunders25 May 2026 18:11 #
Thank you! Would be nice to have `unicode-char()` (and `unicode-character-property()`) but I can't imagine those are priorities for anyone.
Quoted text · Christian Grün · 65 lines
On Mon, May 25, 2026, at 11:54, Christian Grün wrote: > Hi Graydon, > > The spec expects the argument to be resolved against the characters defined in the HTML Living Standard [1,2]. The entity for the double-dagger character seems to be “ddagger”. > > Cheers, > Christian > > [1] https://qt4cg.org/specifications/xpath-functions-40/Overview.html#func-char > [2] https://html.spec.whatwg.org/#named-character-references > ________________________________________ > > Von: Graydon Saunders <graydonish at fastmail.com> > Gesendet: Montag, 25. Mai 2026 17:46 > An: Christian Grün; BaseX; Martin Honnen > Betreff: Re: [basex-talk] Re: Access to the Unicode Character Database from XQuery? > > Hi Christian, > > Curiously, char('dagger') gives me † and char('Dagger') gives me ‡. char('DAGGER') returns an error: "[FOCH0005] Invalid name, glyph or codepoint value: DAGGER (similar: Dagger)." > > None of the case permutations of character:getName(0x2021) which is "DOUBLE DAGGER" are acceptable to `char()`. The numeric, 0x2021, works. (The optimizer happily reduces all of these that work to string literals.) > > I'm using BaseX 12.3, if that should be relevant. > > Thanks! > Graydon > > On Mon, May 25, 2026, at 11:26, Christian Grün via BaseX-Talk wrote: > You can also do: > > char('dagger'), > char(0x2020) > > > ________________________________________ > Von: Martin Honnen via BaseX-Talk <basex-talk at mailman.uni-konstanz.de<mailto:basex-talk at mailman.uni-konstanz.de>> > Gesendet: Montag, 25. Mai 2026 17:16 > An: basex-talk at mailman.uni-konstanz.de<mailto:basex-talk at mailman.uni-konstanz.de> > Betreff: [basex-talk] Re: Access to the Unicode Character Database from XQuery? > > > On 25/05/2026 17:03, Graydon Saunders via BaseX-Talk wrote: > > > > I am currently exploring what to do when a footnote callout, which > > will wind up in an xs:ID value, is something like U+2020 DAGGER; one > > obvious way is to use the character name. (So instead of an @id value > > of `Fn1` I'd have `Fndagger` or similar.) > > > > I see that the current draft of XPath 4.0 has new-since-3.0 > > `characters()` and `grapheme()` functions, but so far as I may tell it > > does not have a way to get UCD properties for a codepoint. > > > > Is there an XQuery (or BaseX) way to do this? > > > > You can call Java > > declare namespace character = "java:java.lang.Character"; > > character:getName(0x2020) > > > >
CG
Christian Grün25 May 2026 18:20 #
There have been attempts into that direction, but it was eventually abandoned due to its complexity: https://github.com/qt4cg/qtspecs/issues/1069
Quoted text · Graydon Saunders · 47 lines
Von: Graydon Saunders <graydonish at fastmail.com> Gesendet: Montag, 25. Mai 2026 18:11 An: Christian Grün; BaseX; Martin Honnen Betreff: Re: [basex-talk] Re: Access to the Unicode Character Database from XQuery? Thank you! Would be nice to have `unicode-char()` (and `unicode-character-property()`) but I can't imagine those are priorities for anyone. On Mon, May 25, 2026, at 11:54, Christian Grün wrote: Hi Graydon, The spec expects the argument to be resolved against the characters defined in the HTML Living Standard [1,2]. The entity for the double-dagger character seems to be “ddagger”. Cheers, Christian [1] https://qt4cg.org/specifications/xpath-functions-40/Overview.html#func-char [2] https://html.spec.whatwg.org/#named-character-references Von: Graydon Saunders <graydonish at fastmail.com<mailto:graydonish at fastmail.com>> Gesendet: Montag, 25. Mai 2026 17:46 An: Christian Grün; BaseX; Martin Honnen Betreff: Re: [basex-talk] Re: Access to the Unicode Character Database from XQuery? Hi Christian, Curiously, char('dagger') gives me † and char('Dagger') gives me ‡. char('DAGGER') returns an error: "[FOCH0005] Invalid name, glyph or codepoint value: DAGGER (similar: Dagger)." None of the case permutations of character:getName(0x2021) which is "DOUBLE DAGGER" are acceptable to `char()`. The numeric, 0x2021, works. (The optimizer happily reduces all of these that work to string literals.) I'm using BaseX 12.3, if that should be relevant. Thanks! Graydon On Mon, May 25, 2026, at 11:26, Christian Grün via BaseX-Talk wrote: You can also do: char('dagger'), char(0x2020) Von: Martin Honnen via BaseX-Talk <basex-talk at mailman.uni-konstanz.de<mailto:basex-talk at mailman.uni-konstanz.de><mailto:basex-talk at mailman.uni-konstanz.de<mailto:basex-talk at mailman.uni-konstanz.de>>> Gesendet: Montag, 25. Mai 2026 17:16 An: basex-talk at mailman.uni-konstanz.de<mailto:basex-talk at mailman.uni-konstanz.de><mailto:basex-talk at mailman.uni-konstanz.de<mailto:basex-talk at mailman.uni-konstanz.de>> Betreff: [basex-talk] Re: Access to the Unicode Character Database from XQuery? On 25/05/2026 17:03, Graydon Saunders via BaseX-Talk wrote: > > I am currently exploring what to do when a footnote callout, which > will wind up in an xs:ID value, is something like U+2020 DAGGER; one > obvious way is to use the character name. (So instead of an @id value > of `Fn1` I'd have `Fndagger` or similar.) > > I see that the current draft of XPath 4.0 has new-since-3.0 > `characters()` and `grapheme()` functions, but so far as I may tell it > does not have a way to get UCD properties for a codepoint. > > Is there an XQuery (or BaseX) way to do this? > You can call Java declare namespace character = "java:java.lang.Character"; character:getName(0x2020)
GS
Graydon Saunders25 May 2026 19:10 #
Seems completely fair. Several of the proposed versions of the functionality would need some form of multi-keyed data structure someone would have to invent, too. Which seems like a lot.
Quoted text · Christian Grün · 81 lines
On Mon, May 25, 2026, at 12:20, Christian Grün wrote: > There have been attempts into that direction, but it was eventually abandoned due to its complexity: > https://github.com/qt4cg/qtspecs/issues/1069 > > ________________________________________ > Von: Graydon Saunders <graydonish at fastmail.com> > Gesendet: Montag, 25. Mai 2026 18:11 > An: Christian Grün; BaseX; Martin Honnen > Betreff: Re: [basex-talk] Re: Access to the Unicode Character Database from XQuery? > > Thank you! > > Would be nice to have `unicode-char()` (and `unicode-character-property()`) but I can't imagine those are priorities for anyone. > > On Mon, May 25, 2026, at 11:54, Christian Grün wrote: > Hi Graydon, > > The spec expects the argument to be resolved against the characters defined in the HTML Living Standard [1,2]. The entity for the double-dagger character seems to be “ddagger”. > > Cheers, > Christian > > [1] https://qt4cg.org/specifications/xpath-functions-40/Overview.html#func-char > [2] https://html.spec.whatwg.org/#named-character-references > ________________________________________ > > Von: Graydon Saunders <graydonish at fastmail.com<mailto:graydonish at fastmail.com>> > Gesendet: Montag, 25. Mai 2026 17:46 > An: Christian Grün; BaseX; Martin Honnen > Betreff: Re: [basex-talk] Re: Access to the Unicode Character Database from XQuery? > > Hi Christian, > > Curiously, char('dagger') gives me † and char('Dagger') gives me ‡. char('DAGGER') returns an error: "[FOCH0005] Invalid name, glyph or codepoint value: DAGGER (similar: Dagger)." > > None of the case permutations of character:getName(0x2021) which is "DOUBLE DAGGER" are acceptable to `char()`. The numeric, 0x2021, works. (The optimizer happily reduces all of these that work to string literals.) > > I'm using BaseX 12.3, if that should be relevant. > > Thanks! > Graydon > > On Mon, May 25, 2026, at 11:26, Christian Grün via BaseX-Talk wrote: > You can also do: > > char('dagger'), > char(0x2020) > > > ________________________________________ > Von: Martin Honnen via BaseX-Talk <basex-talk at mailman.uni-konstanz.de<mailto:basex-talk at mailman.uni-konstanz.de><mailto:basex-talk at mailman.uni-konstanz.de<mailto:basex-talk at mailman.uni-konstanz.de>>> > Gesendet: Montag, 25. Mai 2026 17:16 > An: basex-talk at mailman.uni-konstanz.de<mailto:basex-talk at mailman.uni-konstanz.de><mailto:basex-talk at mailman.uni-konstanz.de<mailto:basex-talk at mailman.uni-konstanz.de>> > Betreff: [basex-talk] Re: Access to the Unicode Character Database from XQuery? > > > On 25/05/2026 17:03, Graydon Saunders via BaseX-Talk wrote: > > > > I am currently exploring what to do when a footnote callout, which > > will wind up in an xs:ID value, is something like U+2020 DAGGER; one > > obvious way is to use the character name. (So instead of an @id value > > of `Fn1` I'd have `Fndagger` or similar.) > > > > I see that the current draft of XPath 4.0 has new-since-3.0 > > `characters()` and `grapheme()` functions, but so far as I may tell it > > does not have a way to get UCD properties for a codepoint. > > > > Is there an XQuery (or BaseX) way to do this? > > > > You can call Java > > declare namespace character = "java:java.lang.Character"; > > character:getName(0x2020) > > > > > >

⚡Generated with XQuery