Subject: [xsl] Re: Generate identifier From: "Vladimir Nesterovsky" <vladimir@xxxxxxxxxxxxxxxxxxxx> Date: Thu, 7 Jan 2010 19:50:12 +0200 |
I have missed the original post, but the effect of diacritics is quite different from language to language. Sometimes it is "only" an accent, in other languages it changes the sound and sometimes meaning of a character. What is a "Western" language? If you think of European languages, there are some that do not use ASCII characters at all (Cyrillic, Greek) and your method will not work. So I would just drop them or replace them with an underscore. Saves a lot of energy :-)
<!-- Creates a normalized name for a specified name components. $component - name components to generate normalized name for. $default-name - a default name in case a name cannot be built. Returns a normalized name. --> <xsl:function name="t:create-name" as="xs:string?"> <xsl:param name="components" as="xs:string*"/> <xsl:param name="default-name" as="xs:string?"/>
<xsl:sequence select=" if (empty($parts)) then $default-name else string-join ( ( for $i in 1 to count($parts), $part in $parts[$i] return if (($i = 1) and ($part lt ':') and ($part ge '0')) then (($default-name, 'N')[1], $part) else $part ), '-' )"/> </xsl:function>
-- Vladimir Nesterovsky http://www.nesterovsky-bros.com/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] re: Generate identifier, Michael Müller-Hille | Thread | Re: [xsl] Re: Generate identifier, Vyacheslav Sedov |
RE: [xsl] How can I achieve correct, Michael Kay | Date | Re: [xsl] Re: Generate identifier, Vyacheslav Sedov |
Month |