extending morphism of function fields overflying  proof of Theorem 50.2.6. from stacks dealing with a bunch of equivalent categories to curves I faced in the quoted excerpt below a general  principle which I not fully understand:

If $f:X→Y$ is a nonconstant morphism of nonsingular projective curves, then $f$ sends the generic point $η$ of $X$ to the generic point $ξ$ of Y. Hence we obtain a morphism $k(Y) = \mathcal{O}_{Y, \xi } \to \mathcal{O}_{X, \eta } = k(X)$ in the category (1). If two morphisms $f,g:X→Y$ gives the same morphism $k(Y)→k(X)$, then by the equivalence between (1) and (2), f and g are equivalent as rational maps, so $f=g$ by Lemma 50.2.2. Conversely, suppose that we have a map $k(Y)→k(X)$ in the category (1). Then we obtain a morphism $U→Y$ for some nonempty open $U⊂X$. By Lemma 50.2.1 this extends to all of X and we obtain a morphism in the category (5). Thus we see that there is a fully faithful functor (5)→(1). 

why the map of function fields or using modern language stalks at generic points  $\mathcal{O}_{Y, \xi } \to \mathcal{O}_{X, \eta }$ can be extended to a map of open subsets $U \to V \subset Y$ containing generic points?
does it boil down to a general principle like let $X=Spec(R),Y=Spec(A)$ wlog irreducible, affine schemes and $f_{\eta}: Frac(A)=\mathcal{O}_{Y, \xi } \to \mathcal{O}_{X, \eta }=Frac(R)$ morphism of generic stalks then it extends to a morphism of open sets of $X$ resp. $Y$. when such extensions work and why?
translating to problem to comm algebra one asks if there exist $t \in R, s\in A$ such that the inclusion $Frac(A) \to Frac(R)$ etends to a map $A_s \to R_t$ of the localisations of $R$ resp. $A$ since the open sets $D(t)$ form a basis of the Zariski topology.
 A: Let $k$ be a field, let $X$ and $Y$ integral schemes locally of finite type over $k$. Then any unital homomorphism $\phi:K(Y)\rightarrow K(X)$ respecting the $k$-algebra structure is induced by a $k$-morphism $U\rightarrow Y$ where $U$ is a non-empty affine open subset of $X$.
Take any non-empty affine open subscheme $V\subset Y$. $V\approx \mathrm{Spec}\:R$ is necessarily integral (this can be inferred from the definitions of irreducibility and reducedness) so there is an injective unital homomorphism $R\rightarrow K(Y)$. We can compose it with $\phi$ to get a map $\psi:R\rightarrow K(X)$. Since $R$ is a finitely generated $k$-algebra and $K(X)$ is defined as a directed union of rings $\bigcup_i R_i$ where $R_i$ is the coordinate ring of a non-empty affine open subscheme of $X$ (the transition maps in the directed colimit are injective because $X$ is integral, as mentioned here for example), $\psi(R)$ is contained in $R_i$ for some $i$. Therefore, we have a well-defined map $R\rightarrow R_i$ which corresponds to a map $\mathrm{Spec}\:R_i=U\rightarrow V\subset Y$.
I think one can not weaken the hypotheses on $X$ and $Y$ too much (they have to locally of finite type over a fixed base). For example, if $X=\mathrm{Spec}\:\mathbb{Z}$ and $Y=\mathrm{Spec}\:\mathbb{Q}$ (both are Noetherian integral affine schemes), then there is a unital homomorphism $K(Y)\rightarrow K(X)$ that is not induced by a morphism $U\rightarrow Y$ for any non-empty open subscheme $U\subset X$. There is simply no morphism from any non-empty open subscheme of $X$ to $Y$.
