Triangular stochastic differential equations with boundary conditions