Your first duty in this stage is to escort the siege ramps to their destination, but not too far into the battle, Wei soldiers will begin dropping boulders from atop the castle and there will be plenty of ballistae that appear, too. You need to use the catapults that show up to try and destroy the ballistae, but they're likely going to be destroyed before you get the chance to.
If you keep waiting, eventually an underground passage will present itself that will lead to the castle's interior. A secondary unit, which consists of Xingcai if you're playing as her, will need to head inside and capture the castle's armory. Otherwise, just stick to the outside and take out all of the reinforcements that get sent at Shu's forces.
Once the secondary force takes the armory, the siege weapons on top of the castle's walls will cease functioning. This will make your own siege weapons break through the castle's walls, allowing access to the inside. As you approach the commander, Zhang He will show up, so take him out and then go after the commander to finish the battle.
There will be enemy ambush troops at one point that will injure Zhang Bao, who will end up dying from it at the end of the battle. This can be a tricky one to get, as there's no clear indication on how to get it. It's best to play as Zhang Bao and follow the battle until you break into the castle. Now, DO NOT enter the main gates and into the small room on the map, as that is where the ambush happens.
Instead, take one of the catapults and bring it inside the courtyard area. There is a cracked wall on the west side that can be destroyed, allowing you access inside without triggering the ambush. Go into one of the side rooms to spot the ambush troops. Defeat the both and then finish the battle.