xsl-list
[Top] [All Lists]

Re: [xsl] Random UUID in pure XSLT?

2020-11-10 16:09:09
Maybe XSLT could have a built-in function? SPARQL has functions UUID()
and STRUUID(): https://www.w3.org/TR/sparql11-query/#func-uuid

On Tue, Nov 10, 2020 at 9:56 PM Piez, Wendell A. (Fed)
wendell(_dot_)piez(_at_)nist(_dot_)gov 
<xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> wrote:

XSL-List,



Thanks everyone for your answers so far. Very illuminating.



The good news seems to be as Dimitre reassures us that this is certainly 
possible in some form. An extension function of some kind may be in order. I 
like both of Mike Kay’s ideas. At its essence, however, this isn’t really a 
question about how to extend XSLT’s native capability, but about how to 
deploy and support such an extension. (While it seems that no one has 
anything for RFC 4122 v4 already wired up.)



So yes (answering Liam), this is for SaxonHE or indeed “generic XSLT 
3.0/XPath 3.1”, across a dispersed community of developers only a very few of 
whom are XSLT-literate. A low-end, low-security option such as passing a list 
of UUIDs in at runtime could even be a possibility, at least for some subset 
of users.



Gratefully,

Wendell



From: Dimitre Novatchev dnovatchev(_at_)gmail(_dot_)com 
<xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com>
Sent: Tuesday, November 10, 2020 3:25 PM
To: xsl-list <xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com>
Subject: Re: [xsl] Random UUID in pure XSLT?



Hi Wendell,



This question has definite answers even for XSLT 1.0, see for example this SO 
question:


XSLT generate UUID


And we have had pure XSLT 1.0 random sequence generators since 2002 (FXSL):

Casting the Dice with FXSL: Random Number Generation Functions in XSLT



HTH,

Dimitre



On Tue, Nov 10, 2020 at 8:36 AM Piez, Wendell A. (Fed) 
wendell(_dot_)piez(_at_)nist(_dot_)gov 
<xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> wrote:

XSL Friends –



Today I write from the day job, where I am researching the question of how 
can I go about producing random UUIDs, in dozens or hundreds, inside an XSLT 
pipeline, without extension functions in Saxon. The Java randomUUID() 
function works nicely when it’s available, but I need to distribute the 
capability for SaxonHE and eventually SaxonJS.



We do not have an available implementation of RFC 4122 v4 “random UUID” in 
pure XSLT do we, free to use (and study)? I know the functional nature of the 
language makes randomness, um, problematic (when isn’t it?), which sometimes 
means workarounds – that’s all fine. Indeed so would calling out to a web 
service if it is known to be reliable. I have thought about handing a list of 
UUIDs in at runtime, but as I said, there may sometimes be hundreds and 
perhaps thousands, which makes that approach seem a bit scary.



Any thoughts or perspective would be most welcome.



Thanks, Wendell







XSL-List info and archive

EasyUnsubscribe (by email)




--

Cheers,

Dimitre Novatchev

---------------------------------------

Truly great madness cannot be achieved without significant intelligence.

---------------------------------------

To invent, you need a good imagination and a pile of junk

-------------------------------------

Never fight an inanimate object

-------------------------------------

To avoid situations in which you might make mistakes may be the

biggest mistake of all

------------------------------------

Quality means doing it right when no one is looking.

-------------------------------------

You've achieved success in your field when you don't know whether what you're 
doing is work or play

-------------------------------------

To achieve the impossible dream, try going to sleep.

-------------------------------------

Facts do not cease to exist because they are ignored.

-------------------------------------

Typing monkeys will write all Shakespeare's works in 200yrs.Will they write 
all patents, too? :)

-------------------------------------

Sanity is madness put to good use.

-------------------------------------

I finally figured out the only reason to be alive is to enjoy it.



XSL-List info and archive

EasyUnsubscribe (by email)

XSL-List info and archive
EasyUnsubscribe (by email)
--~----------------------------------------------------------------
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>