How do you attack the palace in xiangqi?
These answers restate the rules implemented by our open-source engine, which follows the WXF laws for movement, checkmate and both repetition rulings: a side that forces a repetition by perpetual check or perpetual chase loses rather than drawing. The chase half has not been validated against the official casebook. Where an answer refers to a specific position, that position lives on the linked reference page, where the build verifies it before publishing.
Direct answer
Three ingredients: at least two pieces, a line into the palace (usually the central file), and, if you can get it, one advisor removed. Then the order matters more than anything: bring the pieces first, open the line second, strike last.
Why two pieces is the minimum
One attacker is met by one defender and nothing happens — you have spent a move and the defender has spent a move, and you are no closer. Nearly every mating pattern in the game uses exactly two attacking pieces, which is both the minimum and, usually, the requirement.
Removing an advisor
Most attacks that fail against two advisors succeed against one. That makes an advisor worth more than a soldier in this calculation, and giving up material to remove one is routine at strong-player level. It is often the move that makes everything else work.
Related questions
When is an attack ready?
Count pieces you can bring to the palace in three moves against pieces they can bring back. If theirs is larger, it is not ready.
Which file should I attack on?
Usually the central one, because the general sits on it and a cannon there fires through any single screen.