If you are not in the wedding party, you go by a couple of things when deciding what to wear.
What time of day is the wedding? Evening weddings are traditionally more formal than afternoon weddings. For men, a sport coat, slacks, dress shirt, and tie might work at an afternoon church wedding, whereas a nice suit would be better for an evening wedding. For women, something in the range of Sunday best to modest after-five attire would be the right answer. The big no-no color is white, that is reserved for the bride. It used to be that black was not a wedding guest color either, but that has changed over the years and now is acceptable and even fashionable in some areas. If you know the wedding colors, you should try to complement them, while avoid either "matching" them or clashing with them. You don't want to appear as if you are trying to be part of the wedding party, nor would you want to stick out too much in candid group photos. This probably means finding a color and style that is somewhat in keeping with the season. You also shouldn't wear something extremely tight, bare, or revealing to a wedding--no plunging necklines or slits to the waist. Some cathedrals and chapels have requirements for head coverings or wraps, so you might want to try and check on that with someone in the know beforehand.
If the wedding is outside, you need to put a bit more thought into it to plan for the weather conditions, seating, and even the heel type and height for walking to and from the parking to the ceremony. Stiletto heels are probably not the best choice because you might sink in the sod, and would be more likely to trip over roots, rocks, or other outdoor hazards.
Dress comfortably for the weather, but modesty should still prevail. Outdoor weddings are usually more casual, and depending on the location or theme may suggest a style--Hawaiian floral prints for a beach wedding, etc.
Hope that helps!!