Page 1 of 1

Generate Unique Id with 8 Character d1e24262

Posted: Thu Mar 21, 2013 5:33 pm
by idak
Hi,
I want to assign a unique Id to T0X Tag: something like <T0X id = “d1e24262”>
I’m using String id = GenerateIDElementsInfo.generateID("${uuid}", selectedNodeName), but the id generated it’s : d1e26994-8cf0-11bd-b23e-10b96e4ef00d
What pattern id I can use to generate an id with 8 Character

Regards,
Idak

Re: Generate Unique Id with 8 Character d1e24262

Posted: Thu Mar 21, 2013 5:42 pm
by Radu
Hi,

We also have a smaller generated ID value using ${id} like:

Code: Select all

GenerateIDElementsInfo.generateID("${id}", selectedNodeName)
which generates a sequence of about 10 characters and/or numbers.
Or you can take only the first part (before the first "-") from the UUID, of course it would not be guaranteed anymore to be unique.

Regards,
Radu

Re: Generate Unique Id with 8 Character d1e24262

Posted: Thu Mar 21, 2013 6:12 pm
by idak
Hi Radu,

I already try both cases and I have a validation error:
E [Xerces] cvc-attribute.3: The value '6d696d14' of attribute 'id' on element 'T0X' is not valid with respect to its type, 'ID'.
Other Ids are generated by xsl (id=${uuid})

Regards,
Idak

Re: Generate Unique Id with 8 Character d1e24262

Posted: Thu Mar 21, 2013 6:18 pm
by Radu
Hi Idak,

Just prepend some character value to it in order to be sure that the value does not start with a number like:

"id_6d696d14"

Regards,
Radu

Re: Generate Unique Id with 8 Character d1e24262

Posted: Thu Mar 21, 2013 6:23 pm
by idak
Hi,
it works thank you.