Subject: Re: [xsl] XSLT function for title capitalization? From: "John Lumley john@xxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Mon, 9 Apr 2018 21:04:30 -0000 |
The simplest would be to tokenise to words and then apply-templates with three cases: 1. [1] capitalize($word) 2. $word = (bof,'and'... etc.) - $word 3. capitalize($word) Sent from my iPad > On 9 Apr 2018, at 21:52, David Sewell dsewell@xxxxxxxxxxxx <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote: > > Wondering if anyone has a serviceable function (preferably in XSLT 2/3 but v1 is fine if it works) that takes a string as input and returns it with title capitalization according to English-language editorial practice (for example, Chicago Manual of Style). So for example > > A MEMORANDUM OF UNDERSTANDING ==> A Memorandum of Understanding > > WHERE DID THE DRUIDS COME FROM? ==> Where Did the Druids Come From? > > BEING FOR THE BENEFIT OF [MR.] KITE ==> Being for the Benefit of [Mr.] Kite > > Use case is, as you might guess, processing a lot of titles transcribed as all caps, wanting to convert them to standard title case format. > > It doesn't have to be perfect, just anything that will minimize the need for hand-editing. > > David S. > > -- > David Sewell > Manager of Digital Initiatives > The University of Virginia Press > Email: dsewell@xxxxxxxxxxxx Tel: +1 434 924 9973 > Web: http://www.upress.virginia.edu/rotunda
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] XSLT function for title capit, David Sewell dsewell | Thread | Re: [xsl] XSLT function for title c, David Carlisle d.p.c |
[xsl] XSLT function for title capit, David Sewell dsewell | Date | Re: [xsl] XSLT function for title c, David Carlisle d.p.c |
Month |