I have written an XSL style sheet to present the toolkit XML database in a report format that can be viewed in a browser and/or printed. I thought others might find it useful. I took my inspiration from Daniels posts on 'Hacking the database'. Now this is my first XSL template so if there are any professionals out there, then go easy on me (and more importantly, submit something as well). To make it work you need to modify the toolkit xml file slightly, but don't worry it's easy and can be done with Notepad. Find the XML project file in the Clipsal\c-gate2\tag directory and make a copy of it. Do not work on the original! Open the copy using notepad or another text editor. Now what you will see looks like a big mess, but it's not. It's just unformatted XML. Then find the line <Installation xmlns="http://www.clipsal.com/cis/schema/2001/cbus.xsd"> . and change this to <Installation xmlns=""> , ie. delete the content between the quotes. (it will be the first or second line) Then directly after the line <?xml version="1.0" encoding="utf-8"?> type the following <?xml-stylesheet type="text/xsl" href="Report1.xsl"?> So the first few lines should look a bit like; <?xml version="1.0" encoding="utf-8"?><?xml-stylesheet type="text/xsl" href="Report1.xsl"?> <Installation xmlns=""><OID xmlns="">4ba125c0-.............. Save the file and thats it. Now make sure you place the attached file Report1.xsl (after you have unzipped it) in to the same directory as the modified copy of the project xml file then, double click the project xml file and you should be presented with a pretty report in your default browser. If you want to print it, the best way I have found is to (in Internet Explorer) right click in the browser window and choose "Select All" then right click again and select print. When the print dialog pops up on the "General" tab check the "selection" radio button in the "Page Range" area then press print. Hopefully you will find this useful. Regards Rohan P.S. I have added a couple of screen shots. Unfortunately they didn't scale very well so you should view them full size, but you can get the idea. Any comments welcome.
I see 22 people have downloaded my code, but I have got no comments. Good or bad, I don't mind as long as it's constructive. I'd just like to know If I'm on the right track or not.
Works well...... had a couple of typo's to find initially, but one i sorted that is was all good. The only improvement i could suggest is to try and make the groups more readable (have no idea how easy/hard that would be). everything else is set out quite clearly..... In saying that, i dont get to play with these things very often, so im open to any comments as well........ Thanks for putting the effort in and sharing
Thanks Michael, Were the typos yours or mine? I agree that presenting the groups in hex is not the greatest (although when I was a lad, way back with c-bus v1 thats all we had ) It can all be done, I could use some inline VBScript or Java script to convert the Hex values to Decimal (I don't think XSL has that capability on it's own). I was even thinking of wrapping it all up with a nice GUI front end that allowed you to select from a number of reports, and it handled all the behind the scenes editing and stuff for you. But I needed to know I wasn't wasting my time first. Regards
Rhamer Be carefull were you get the group address from in switchs, make sure u get the switch group not the memory group like toolkit. Try this in toolkit, add a new switch and set all switchs 1 to 6, save then change the switchs at random patern using the orginal groups and save you can even set some to unallocated. Then see what toolkit says the configuraton is in its documentation and summary output, still as you first entered them. dave
Hi Dave, Thanks for the feedback. I Dont quite follow what you mean. Are you saying that in some cases I am getting the wrong data? I have looked at it again and I think I'm doing it right. This is the element that I am reading for the group addresses; <PP Name="GroupAddress" Value="0x5 0x6 0xff 0x3b 0xff 0xff 0xff 0xff" xmlns="" /> Should I be doing something else? Cheers
I think he's getting at the fact that using the key to block mapping table (remember the groups are on blocks not keys), you can set the mapping to all kinds of wierd things eg key 1->block 8, key 2->block 3, key 3-> block 7, etc). If you do this everything will work - just make sure reports come out with the correct groups and keys (you MAY have to track back thru the key->block mapping table).
Rohan, Thanks for the starting point. Its given me an insight into XML files and how to get info back out. My ulitmate aim is to automate the production of user manuals. The manuals list group addresses - description and actual programming for each switch output unit. While your XSL template does not directly do this, I have written some Visual Basic code in Excel to produce the documents. So far the results are getting better, more accurate and quicker. The problem I am working through is getting the blocks and keys to line up correctly and logic channels. In short great so far, any further insights would be greatly apreciated. Gavin
Hi Gavin, As it happens I have just been tasked with producing some stuff at work that will increase my XML/XSL knowledge considerably. So I hope to have some more stuff out in time. I think taking the XSL approach is the correct one. You can use it to produce all sorts of output and when it is combined with scripting (either VBS or Java) you can really do anything you like. The XML database is the master, and it should be used to extract the required information, although I'm not sure about devices that are not programmed with ToolKit, such as the touchscreens. I would think that a breakdown of the XML structure from CIS would go a long way to helping us understand what is stored where and how to interpret it. It also seems to me to be the obvious way of handling the ToolKit printing issue. Just create a set of XSL style sheets and an intergrated mechanism for associating them with the XML file on the fly from within ToolKit, and you have ultimate flexability. You could allow users to write their own as well and just drop them in the appropriate directory and they appear in the list of selectable reports. Anyway just my thoughts, the important bit is the source data is XML, the rest is just computer stuff
Hey Rohan, 12 months later.... Has there been any updates to this wonderful tool of yours. I must admit I am having a slight problem with finding the <Installation.....> part of the code in my project file, are you sure it is still relavent with toolkit 1.4? When I run the report all I get in the browser is the HTML code. Any suggestions ???? Regards
No I haven't done any more work on it, I just can't seem to find the time. I just tested it again with my latest toolkit project and it works ok for me. Did you follow the instructions in the first post carefully? If you still can't get it working, email me the toolkit xml file and I'll take a look. Cheers Rohan
Ok, I made a mistake and actually edited one of my old files. However I did test it against the correct one and it still works, but the beginning of the toolkit file has changed a little. the only bit you need to do now is; Oh, and make sure you have saved Report1.xsl in the same directory. Cheers Rohan