The examples mentioned earlier are quite representative.
Tips
usage
Pairs with 下文 (xiàwén, 'what follows / the rest of the text'). Together: 联系上下文 ('considering the context, both before and after'). 上文 is academic/written register — in spoken Chinese, you'd say 前面 or 之前.