Can one person represent both parties to the marriage contract, whether by agency or by guardianship?
Yes, this is valid. For example, one person may say to another, “I appoint you as my agent to marry the daughter of so-and-so on my behalf.” The woman’s father may then say to the husband’s agent, “I appoint you as my agent to conclude the marriage contract for my daughter to so-and-so.” Thus, he represents both parties to the contract by agency.
As for doing so by guardianship, this may occur in the case mentioned previously. If a father marries off his minor son, and the son has a female cousin whose guardian he is, then he represents both parties to the contract by guardianship. He may marry her to his son if she consents, since her consent is indispensable.
It may also occur in one’s own capacity. For example, if a man marries his female cousin while he is her guardian, then he has married his ward, who is his female cousin, to himself.