Courts faced with a choice of law issue generally have two choices: (1) A court can apply the law of the forum (lex fori)-- which is usually the result when the question of what law to apply is procedural or deals with real property; or (2) the law of the site of the transaction, or occurrence that gave rise to the litigation (lex loci)-- this is usually the controlling law selected when the matter is substantive.
Many contracts include a choice of law clause that determines what law should apply and even a clause which determines the venue of any such dispute. When the court must consider the foreign law it must be proved by foreign law experts and cannot merely be pleaded as the court has no expertise in the laws of foreign countries or how they might be applied in a foreign court. Such foreign law is technically considered to be evidence, rather than law, for the purposes of the determination of venue.
The Hague Convention on Private International Law is a treaty which governs many of these principles. The deliberations of the convention have recently been the subject of controversy over the extent of cross-border jurisdiction on electronic commerce and defamation issues.