A rigorous version of N- and v-representable energy density-functional theory, formulated in the context of local-scaling transformations, is advanced. The importance of N-representability conditions for the formulation of a density-functional theory that complies with the variational principle is discussed, and particular emphasis is placed in distinguishing functional from one-particle density N and v representability. It is shown, by resorting to local-scaling transformations, how it is possible to actually construct an energy density functional that at all points of variation is strictly equivalent to the expectation value of the N-particle wave function from which the one-particle density is obtained, that is, an energy density functional with built-in N-representability conditions. Some relationships between the present theory and those based on the Hohenberg-Kohn theorems are discussed. In illustration, simple applications of the present theory to two-electron systems are given.