Subject: Re: [xsl] XSLT function for title capitalization? From: "David Sewell dsewell@xxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Tue, 10 Apr 2018 00:29:25 -0000 |
I agree that sentence-style capitalization is (to a contemporary eye) more elegant, but in my particular use case I need to convert for stylistic consistency from all-caps headings to ones using the title casing style in use in specific scholarly editions dating from several decades ago. Nothing is going to free me from a fair bit of hand-editing but a first-approximation transformation will reduce the amount of effort. I had an imperfect tokenization approach but I think David C's suggestion using xsl:analyze-string, with some tweaking, will do. The Chicago Manual decrees that in headline style one capitalizes all nouns, pronouns, verbs, adjectives, adverbs, and most conjunctions, but lowercases articles and prepositions except the latter when used adverbially or adjectivally. "Is" and "He" are noun and pronoun, "at" and "as" prepositions--so the headline style is arbitrary but not illogical. David On Mon, 9 Apr 2018, Michael Kay mike@xxxxxxxxxxxx wrote: > My copy-editors at Wiley tried to impose US-style title capitalization on my book, I found it incredibly ugly: > > !Lula" Is Inmate at Prison He Opened as Brazil"s President <https://www.nytimes.com/2018/04/09/world/americas/brazil-lula-jail.html> > > "Is", "at", "He", "as"? Where's the logic? > > Michael Kay > Saxonica > >> 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 -- David Sewell, Manager of Digital Initiatives ROTUNDA, The University of Virginia Press PO Box 400314, Charlottesville, VA 22904-4314 USA Email: dsewell@xxxxxxxxxxxx Tel: +1 434 924 9973 Web: http://rotunda.upress.virginia.edu/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] XSLT function for title c, Michael Kay mike@xxx | Thread | Re: [xsl] XSLT function for title c, Eliot Kimber ekimber |
Re: [xsl] XSLT function for title c, Peter Flynn peter@xx | Date | [xsl] Match to a condition in two a, sudheshna iyer sudhe |
Month |