How to replace double quotes with single quotes in XSLT?

Converting a US-formatted Microsoft Word document to UK formatting?

  • Is there a way (a macro perhaps?) to change the spellings and punctuation in a Microsoft Word document (.docx) from "American" style to "British" (or should I say, 'British') style in one fell swoop? I have a manuscript which I wrote to submit to an American academic journal in the humanities. After being rejected by this journal, I am looking to submit it to a British journal. This latter journal wants UK spellings and punctuation -- that is, single quotation marks ('like this') for main quotes and double quotation marks (I said, 'John told me "be careful" as he was walking away') for nested quotes. The spelling should be fairly easy to change -- just set the language to English (UK) and American spellings like "color" and "center" and such will get red squiggly underlines. For the punctuation, however, I find myself in a bind. Ctrl+F/Replace is not an option for several reasons: Let's say I replace all double quotation marks (") with single quotation marks ('). If I then try to change single quotation marks to double, I will end up changing all of things I just changed to single quotes back to double quotes! Also, all of the apostrophes I have in the manuscript would end up being changed to double quotation marks. I am using Microsoft Office 2007 on Windows 7. Thanks!

  • Answer:

    You can get creative with doing things like replacing a space followed by a single quote to _leading_single_quote_ and a single quote followed by a space to _trailing_single_quote_ and similarly for double quotes, which should miss apostrophes and such as they shouldn't have spaces around them. You can then go ahead and substitute trailing_single_quote_ with a double quote and then a space, etc. It's not one fell swoop, but it's better than doing them each individually.

dhens at Ask.Metafilter.Com Visit the source

Was this solution helpful to you?

Other answers

Let's say I replace all double quotation marks (") with single quotation marks ('). If I then try to change single quotation marks to double, I will end up changing all of things I just changed to single quotes back to double quotes! I'm not familiar with the specifics of US v UK style, but this is easy to address. 1. change all your doublequotes to something you don't use, like the word (doubletosinglehere) 2. change all your single quotes to double quotes 3. change all instances of your placeholder word (doubletosinglehere) to single quotes. What are the other reasons that Ctrl-F would not work?

jacalata

Changing the language settings at the dictionary and the computer keyboard level will help with the grammar check to pull up the obvious stuff and then you can go through it if you need to. At least that is what I do, perhaps there's an easier way ( I sure hope so to!)

infini

Hmm, the use of placeholder would seem to expedite things, but I think that it would still pose a problem with apostrophes. Following jacalata's example, at step 2 all of my apostrophes would be changed to double quotes.

dhens

Hmm, the use of placeholder would seem to expedite things, but I think that it would still pose a problem with apostrophes. Following jacalata's example, at step 2 all of my apostrophes would be changed to double quotes. Tyler's suggestion takes care of this, though. Unless at any point you have an apostrophe at the start of a word (like 'tis or 'n'), none of your apostrophes should be preceded by a space. So instead of putting just a single quote in the find field, put a space and a single quote to isolate single quotes used as quotes.

payoto

payoto: I didn't even see that (I just glanced over it). I'll definitely have to try that!

dhens

Just a quick update: The system of multiple substitutions worked like a charm, with one hitch: there was no way (to my knowledge) to differentiate between s+trailing single quotes in a nested citation (in US usage, like so): "the 'stakes' of the competition" and s+apostrophe for plural possessive: others' views Once I did all of my substitutions, I searched manually for s" and fixed all of the plural possessives back to s'. Thanks!

dhens

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.