An answer: BeerSmith-like BrewSheet for BTP

General discussion on BeerTools Pro Software.
Post Reply
lonte
Light Lager
Light Lager
Posts: 11
Joined: Sun Jul 15, 2007 12:17 am
Location: Brisbane, Australia

An answer: BeerSmith-like BrewSheet for BTP

Post by lonte »

It would appear that one of the most requested features for BTP is a BeerSmith-like "BrewSheet' showing the running order for a brew day. This is (was?) one thing still tying me to BeerSmith.

Last week I discovered that BTP stores it's recipes in an XML format. I then discovered the wonderful world of XSLT. For those not in the know (as was I until a week ago) XSLT allows you to format XML output for display in a browser with a huge amount of flexibility. It also has a lot more power but for now that will do as an intro.

I set about constructing an XSLT Style Sheet that reflects the BeerSmith Brew Sheet and have it now to the point where I'd like to go public.

If someone will let me know how to attach files to forum posting's I'll post the required documents and instructions. Alternatively, as it is all text, I could include it in a posting if necessary. So, please could a more experienced forum user, or a moderator, let me know best way to provide the files.

Some notes:
* I have no idea if cloning the BeerSmith report is breach of copyright .. if it is then this forum is not the place to post my work.
* I have cloned as close as possible the BeerSmith report. Some fields are just not available in BTP (or I can't find them)
* there are some things about the BeerSmith report I don't like and I've 'fixed' them along the way.
* The stylesheet has undergone minimal testing - in particular I don't usually use Step mashes and so the Schedule area may need some work.
* I haven't finished yet - this is a WIP that is just now at a point that I'm happy to publish.
* this concept is not restricted to one report - XSLT effectively offers a custom report writing platform for BTP.
* in order to apply the XSLT Style Sheet to the .BTP recipe file, you need to insert a tag. Once you do this, BTP refuses to open the file anymore. To work around this I have also written a small HTML Javascript page that takes as a parameter the .BTP file you want to show, and applies the Style sheet to it.
* I have had < 1 week of XSLT exposure. Some parts of the Stylesheet may be the worst XSLT ever written. I am still learning. If you can help or correct, I welcome your input.
shlap
Posts: 9
Joined: Sun Mar 04, 2007 11:41 pm

Post by shlap »

lonte, if you want you can e-mail it to me and I'll upload and post the link here. shlap007 at gmail dot com.
lonte
Light Lager
Light Lager
Posts: 11
Joined: Sun Jul 15, 2007 12:17 am
Location: Brisbane, Australia

Post by lonte »

No worries, if it is only a link that can get posted, then I'll put the files up on my web server and I'll post a link. Thanks.

Edit: OK, download http://www.babbrewers.com/downloads/sof ... splay.html and open it in IE and hopefully it'll be clear how it works. Not entirely sure why but you have to download it, not run it from there. Also, you'll need javascript enabled in your browser. It doesn't work in firefox not entirely sure why probably all the MS proprietary stuff in the javascript to get it to create the XSLT processor. Feedback welcome, Cheers!
User avatar
rrosa
Pale Ale
Pale Ale
Posts: 55
Joined: Mon Jan 15, 2007 8:32 pm
Location: Rio de Janeiro
Contact:

Post by rrosa »

I have a Mac and couldn't make it work on any browser (not even Mac's IE). I think the "showSession" script needs to be modified to work on other browsers. I will look at some scripts that I have and let you know.
Ricardo - http://cervejarte.org/blog
MacBook 2GHz Intel Core 2 Duo 2Gb SDRAM running Mac OS X Snow Leopard 10.6.8
lonte
Light Lager
Light Lager
Posts: 11
Joined: Sun Jul 15, 2007 12:17 am
Location: Brisbane, Australia

Post by lonte »

There is an xml tag you can embed in the .btp file that then applies the xslt to the xml by default in any browser BUT once you embed that tag BTP refuses to acknowledge the file as one of it's own :( You could take a copy, of the file, then straight after the <?xml version="1.0" encoding="UTF-8"?> tag, and before the <Session ...> tag, add a tag <?xml-stylesheet type="text/xsl" href="btpBrewSheet.xsl"?> (with, of course, a valid HREF to the xslt style sheet). This is method is meant to be (more or less) browser and OS independent.
User avatar
mrocco
Light Lager
Light Lager
Posts: 14
Joined: Sat May 12, 2007 9:03 am
Location: Pittsburgh, Pennsylvania

Brewsheet

Post by mrocco »

I've been unable to get this to work using a PC. BTP only generates one kind of file, right? Whenever I try to get "display.htm" to work I get "Error On Page." Java is enabled. I am using IE 7.0.
lonte
Light Lager
Light Lager
Posts: 11
Joined: Sun Jul 15, 2007 12:17 am
Location: Brisbane, Australia

Re: Brewsheet

Post by lonte »

You cannot browse to where I have put display.htm and use it - I do not know why but you must copy it to a local disk - I stress local because it appears to even have problems using network drives of the form \\server...

The alternative is to insert the tag <?xml-stylesheet type="text/xsl" href="http://www.babbrewers.com/downloads/sof ... wSheet.xsl"?> directly into a .btp file as the second tag, like so ...

<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet type="text/xsl" href="http://www.babbrewers.com/downloads/sof ... wSheet.xsl"?><Session version="1.0.28.138">...

and then view the .btp through a browser ... that will work with any browser that supports XSLT but be warned, BTP will not open the file while that tag is embedded.
Post Reply