<< Suit Symbols XML Bridge Tests Auctions >>

Hands

Simple Diagram

Input:
<diagram id="first">
<hand seat="N" sp="AK" he="KQT9" di="AKT98" cl="98"/>
<hand seat="W" sp="JT98" he="876" di="765" cl="AQ7"/>
<hand seat="E" sp="7654" he="J5" di="43" cl="JT654"/>
<hand seat="S" sp="Q32" he="A432" di="QJ2" cl="K32"/>
</diagram>
XSL Output:
A K
K Q 10 9
A K 10 9 8
9 8
J 10 9 8
8 7 6
7 6 5
A Q 7
7 6 5 4
J 5
4 3
J 10 6 5 4
Q 3 2
A 4 3 2
Q J 2
K 3 2
A simple deal diagram - the id attribute is used for references later. It is not required unless you plan to do linking.
Note that the XSL handles the various decisions like spacing, whether to use "10" or "T" for tens, and how to represent the suit symbols.

Copy diagram

Input:
<diagram src="#first"/>
XSL Output:
A K
K Q 10 9
A K 10 9 8
9 8
J 10 9 8
8 7 6
7 6 5
A Q 7
7 6 5 4
J 5
4 3
J 10 6 5 4
Q 3 2
A 4 3 2
Q J 2
K 3 2
I load a diagram from inside the current document.

Copy diagram, external

Input:
<diagram src="xml/test/deal.xml"/>
XSL Output:
Q 10 9
A 8 7 6 5 4 3 2
K J
K J
Q 10 9
A 8 7 6 5 4 3 2
K J
A 8 7 6 5 4 3 2
Q 10 9
A 8 7 6 5 4 3 2
Q 10 9
K J
Load the first diagram with from test/deal.xml.

Copy diagram, external http

Input:
<diagram src="http://bridge.thomasoandrews.com/impossible/bin/impossible.cgi?pageNumbers=10000000000000000000000000000&amp;format=XML"/>
XSL Output:
10 7 3
J 10 8 7 6 4
8 2
10 7
J 9 6 5
A Q
A
A K Q J 9 3
K Q 2
5 3 2
K Q 9 7
8 5 2
A 8 4
K 9
J 10 6 5 4 3
6 4
Load a diagram by a URL, here finding the 10,000,000,000,000,000,000,000,000,000th page of the Impossible Bridge Book. This won't work if you are not connected to the internet.

Copy diagram, external with ID

Input:
<diagram src="xml/test/deal.xml#2"/>
XSL Output:
Q
A 8 7 6 5 4 3 2
K J
K J
Q 10
A 8 7 6 5 4 3
K
A 8 7 6 5 4 3 2
10 9
A 8 7 6 5 4 3
Q 10 9
J
Load the diagram with id='2' from test/deal.xml.
This ability to link across documents is one of the beauties of XML, and one of the reasons that some XML schema is probably better than PBN in the long run. For example, you could have a single document which consisted of the deals from a tournament, with ids set as board numbers, and then have the "results" tables reference the deals. This eliminates the redundancies built into PBN and sequesters the data.

One-suited diagram

Input:
<diagram>
<hand seat="N" sp="QT9"/>
<hand seat="W" sp=""/>
<hand seat="E" sp="KJ"/>
<hand seat="S" sp="A8765432"/>
</diagram>
XSL Output:
Q 10 9
K J
A 8 7 6 5 4 3 2
A single-suited diagram. This one currently doesn't format so good with the long suit and void.

North and East Only

Input:
<diagram>
<hand seat="N" sp="QT9" he="AJT9" di="9654" cl="K2"/>
<hand seat="E" sp="AJ32" he="K" di="AKQJ" cl="AQJT"/>
</diagram>
XSL Output:
Q 10 9
A J 10 9
9 6 5 4
K 2
A J 3 2
K
A K Q J
A Q J 10
A diagram with only north and east.
<< Suit Symbols
Thomas Andrews (bridge@thomasoandrews.com), © 2002-2009.
Auctions >>
Article formatted with BridgeML.