Complex sentence: On the western wall, a single entrance gate provided access within which a second gate formed an entrance to an "upper city" of the palace compound and its attached chapel.
Split into simpler sentences: On the western wall, a single entrance gate provided access. Within this a second gate formed an entrance to an "upper city" of the palace compound and its attached chapel.