XML and Bridge Publishing
XML as replacement for PBN
PBN is the current standard for records of bridge hands. I have some problems with PBN, and think that an XML language can likely be substituted with ease. The big problem with PBN is that it is not very extensible and requires a very specific parser. But I have a number of other gripes which make PBN also flawed from an engineering perspective.
XSLT formatting to HTML and XHTML
All of the bridge hand articles on my site are now written in XML, and pre-generated as HTML via XSLT. You can see some Test Documents which show what the input and output look like.
The following examples will generate on the fly if you have a browser which implements XSLT - in this case, I've chosen to generate XHTML because Mozilla seems to have a few problems still.
If you have Internet Explorer 6.0 or later, or any Mozilla-based browser after Mozilla 1.0, you can view these examples.
- deals.xml
- A set of 36 deals, formatted with xhtml.xsl. If you examine the XML source, you'll see that the file is a linear list of deals; it is generated into a pair of 3x6 tables of deals by the XSLT.
- everybody.xml
- The "Everybody Makes" article, formatted with base.xsl. Tens are written as "10", voids are written as a pair of emdash characters, "——", and suit symbols are written using suit symbol characters.
- everybody2.xml
- The "Everybody Makes" article formatted with alt.xsl, a variant of base.xml. It uses Danish letters for honors, "T" for tens, "---" for voids, and graphics for the suit symbols. I had to change the "import" tags for this example to make it work in Mozilla due to an XSL import bug.
- shared.xsl
- The XSL shared by the alt.xsl and base.xsl.
Internet Explorer uses the associated XSL files to format the file on your end. To view the un-formatted XML, view the formatted document, then select "View/Source."
Netscape and Mozilla will eventually catch up with IE, and IE will eventually let you have several XSLT files to choose from. [ Netscape 6.0 seems to have limited ability with XSLT, but it tranforms my documents wrong. I.E. agrees with the Xalan Java XSLT, for example. ]
Server-Side Versions of the Examples
If you have an older browser, you can view the output from these examples with these links:- deals.xml
- everybody.xml styled with base.xsl.
- everybody.xml styled with alt.xsl.
XML and JavaScript
If you have IE 6.0 or Mozilla 1.0 with JavaScript enabled, you can run my
sample Deal Browser, which
loads the set of deals in deals.xml
and lets you scroll
through them one at a time.
As an argument for using XML rather than PBN, I think this is a fairly convincing example - with PBN, a browser would have to use Java applet or a plug-in to load and parse the PBN file.
JavaScript can also be used to generate "smart" article sets. For example, see this non-framed version of my "Double Asymmetries" articles. In fact, this "book" is loaded all at once, but only one article at a time is viewed. It uses cookies to remember the last article you viewed, so that when you return later, it returns you to the last article you viewed (unless the articles have been modified.) You can imagine a similar approach for so-called "bridge movies."
Compare this with the framed version.
XSL:FO and PDF
XSL:FO is the "formatting objects" part of the XSL standard. It basically lets you describe documents meant to be printed. Once an XML document is converted to XSL:FO with XSLT, an XSL:FO documented can be converted to PDF or postscript or any other printable format. I've tried two FO implementations:
- RenderX's demo
- RenderX makes an XSL:FO implementation, and give away a free evaluation copy with limitations. The worst one is that it is essentially limited to 10 pages.
- FOP from apache.org
- Free, but unfortunately the FOP "keep-together" feature doesn't work, which means that bridge diagrams don't stay on one page, which is rather unfortunate. They're working on it, I am told.
The PDF version of the Everybody Makes article shows some distinctly subtle formatting - played cards are not "removed" from the diagram, they are just indicated with a line through, smaller, and in a light font.
Download BridgeML (version 0.5)
BridgeML now has its own Google Code Project.
Read the latest README file.
Download BridgeML-0.5.zip
The latest version of BridgeML uses xsltproc, so you will need that program installed on your computer, if it is not there already. You need a recent version of the program, because some older versions had broken handling of EXSLT extensions.
Non-XML Bridge Publishing Notes
Here are some links to bridge web publishing notes which are independent of XML.
- HTML Bridge Deal Layout Without Tables
- There is a movement towards using style sheets rather than HTML tables to do complicated layouts, using HTML tables only for data which really is tabular.
- Jeff Goldsmith's Bridge Movie Software
- Jeff's tool was one of the first I saw for making publishing bridge articles in HTML easier.
- PBN Homepage
- Includes the specification for the Portable Bridge Notation, as well as lists of software which support PBN.
Copyright 2000-2005.