I'm in agreement with what Yorkie says. I will give a brief explanation with regard the individual stages of use of the routeing guide, you will find lots of examples in the routeing guide in detail link which Yorkie has provided, and also on this message board.
Firstly we need to find the relevent routeing points. In this case, both Barnsley and Doncaster are routeing points. This makes this a simple example, things can get a little more complicated when you are dealing with stations which are not routeing points.
http://www.atoc.org/clientfiles/File/RSPDocuments/routeing_point_identifier.pdf
Next, we need to find the routeing permissions for Barnsley-Doncaster. These are JL and PS.
http://www.atoc.org/clientfiles/File/RSPDocuments/permitted_route_identifier.pdf
Now, we need to find which routes these routeing permissions allow. We do this looking at the maps section.
Map JL allows Barnsley-Wakefield-Doncaster.
Map PS allows Barnsley-Meadowhall-Swinton-Doncaster.
http://www.atoc.org/clientfiles/File/RSPDocuments/maps.pdf
As there are engineering works effecting the Wakefield-Doncaster route, we use the following paragraph on page 6 of the instructions:
"ENGINEERING WORK, DIVERSIONS AND SERVICE DISRUPTION
The Routeing Guide has been produced using the published rail timetable and
fares manuals. It therefore takes into account all route variations allowed
that have been notified. On occasions due to short notice engineering work
and disruption, services may be diverted from their normal routes or
customers asked to use alternative routes. In these circumstances operators
will make special provision to allow extra permitted routes. They will advise
other operators and retailers of the extra provisions made to convey
customers by routes other than those which are normally permitted. This
provision will also apply to connecting services which are not directly
affected. Any through train diverted from its usual route will count as a
permitted route between the stations it is normally scheduled to call at. This
does not apply to additional stops on the diversionary route, unless specially
advised or they are on the permitted route for the journey being made."
http://www.atoc.org/clientfiles/File/RSPDocuments/instructions.pdf
As Wakefield-Doncaster is normally on a permitted route for a Barnsley-Doncaster ticket, the ticket automatically becomes valid on the diverted East Coast services via Leeds, even so Leeds is not normally a valid route. Note that the ticket will not be valid on any other services via Leeds.