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

Re: Generate identifier

Subject: Re: Generate identifier
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Tue, 29 Dec 2009 10:26:10 -0500
Re:  Generate identifier
At 2009-12-29 07:13 -0800, Vladimir Nesterovsky wrote:
I need to convert a string into an identifier.

Does that string include white-space?


Do your identifiers have to be unique or are you
allowed to create the same identifier for two different input strings?

Earlier I was using the following function:
...
Now, I have to build a name with only containing [A-Za-z0-9] only.

That is very limiting ... the value space for names in XML includes hyphen and underscore, both of which would be handy ... are you sure those two characters are not allowed?

My problem is that I often see characters with modifiers like
00E0 C  LATIN SMALL LETTER A WITH GRAVE
00E1 C! LATIN SMALL LETTER A WITH ACUTE
00E2 C" LATIN SMALL LETTER A WITH CIRCUMFLEX
00E3 C# LATIN SMALL LETTER A WITH TILDE
00E4 C$ LATIN SMALL LETTER A WITH DIAERESIS
...

My questions:
  is it acceptable, from the perspective of a
western language, to replace those characters
with a character without modifier;

I don't think it is a western language question. Typically identifiers are created to be unique ... if you allow ambiguity, will you still get the transformation results you are expecting for your downstream processes?

  is there a way to do this in xslt;
  any better option?

How about a convention of two identifier characters for every string character, using the second character as a modifier, and some fixed value for "unmodified"?

Thus "abc" would be "a0b0c0" and "dij`" would be
"d0eGj0aA" where "G" is for grave and "A" is for
acute.  With underscore available you could use
it as a diacritic introducer, such that "abc"
would be "abc" and "dij`" would be "de_Gja_A",
thus not changing any string that doesn't have any special characters.

But without knowing more about your constraints,
it is difficult to think of what to suggest.

I hope this gives you some ideas.

. . . . . . . . . . Ken

--
UBL and Code List training:      Copenhagen, Denmark 2010-02-08/10
XSLT/XQuery/XPath training after http://XMLPrague.cz 2010-03-15/19
XSLT/XQuery/XPath training:   San Carlos, California 2010-04-26/30
Vote for your XML training:   http://www.CraneSoftwrights.com/s/i/
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/s/
Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video
Video lesson:    http://www.youtube.com/watch?v=PrNjJCh7Ppg&fmt=18
Video overview:  http://www.youtube.com/watch?v=VTiodiij6gE&fmt=18
G. Ken Holman                 mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Male Cancer Awareness Nov'07  http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal

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.