Williams SX Book Index (in XML)
John Couture
Posts: 370
Too All,
As per our discussion a couple of days ago, attached is the index to Al Williams "Exploring the SX Microcontroller w/ Asm and Basic, Ver 3.0".·
To view the index, unzip it into a directory·and click on "bookindex.htm".
For those of you that are into software, the·index is actually an XML file with an XSL script which is called by a JavaScript wrapper (I did it as a challenge to myself).· The application is broken down into three files so that it can easily be modified:
bookindex.xml - this is the data file with the following format:
·· Root
····· Row
········ topic
········ page
········ isbn
bookindex.xst - this is the xml type processing script with a pseudo FOR NEXT structure (for those of you that don't know, XSL doesn't have a FOR NEXT command, you have to implement it as a recursive structure).
bookindex.htm - this is a 13 line javascript file that merges the above two files together.
It was fun and took me the better part of a day to figure out how to implement a FOR / NEXT structure (read lots of posts online).· Hopefully some of you will have as much fun taking it apart as I had a putting it together.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
John J. Couture
San Diego Miramar College
As per our discussion a couple of days ago, attached is the index to Al Williams "Exploring the SX Microcontroller w/ Asm and Basic, Ver 3.0".·
To view the index, unzip it into a directory·and click on "bookindex.htm".
For those of you that are into software, the·index is actually an XML file with an XSL script which is called by a JavaScript wrapper (I did it as a challenge to myself).· The application is broken down into three files so that it can easily be modified:
bookindex.xml - this is the data file with the following format:
·· Root
····· Row
········ topic
········ page
········ isbn
bookindex.xst - this is the xml type processing script with a pseudo FOR NEXT structure (for those of you that don't know, XSL doesn't have a FOR NEXT command, you have to implement it as a recursive structure).
bookindex.htm - this is a 13 line javascript file that merges the above two files together.
It was fun and took me the better part of a day to figure out how to implement a FOR / NEXT structure (read lots of posts online).· Hopefully some of you will have as much fun taking it apart as I had a putting it together.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
John J. Couture
San Diego Miramar College
Comments
I've spent many an afternoon figuring out the best way to execute a loop or create a conditional that responds to text, attributes or some sort of counter in XSLT. It's a great feeling of accomplishment when you manage to write that code and it works.
If you're looking for a decent XSL reference guid, I'd recommend XSLT Developers Guide from McGraw Hill (Osborne). It's geared towards readers with an understanding of how the whole XLM/XSL thing works and it's a few years old now but it's been a great help to me.
I took your work and added to it slightly. I noticed that your using the Microsoft XML.DOM which of course doesn't work with non-MS browsers so for those who use XML supporting browsers that aren't IE I changed the declaration on your XML file to load the XSL file when it is opened in the browser as XML. It is attached below in a zip file. Open it directly in any XML supporting browser and it will run the XSL transformation directly.
I wonder if we should/could take the entire text into xml?
EDIT: I changed the attached zip file to include both XML & XSL files to avoid confusion.
Cheers,
Andrew
Thank you. Sorry I took so long to get back to you. This is the end of the first week of my classes. A little hectic.
I had forgotten about that little trick. I think I separated the data, logic and transformer because in the past I wanted to apply different XSLT files to a common XML file.
Anyways, after reading a couple of posts from Ken Gracey about the future of the SX and this month's NV article from Jon Williams, I am more encouraged than ever to develop curriculum around it. I just need to think of a clever way to write a series of chapters that can be improved upon by the group and have it in something like a content manager or an XML format. I guess I'll have to dust off my "thinking cap" (to use a VERY old term!!).
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
John J. Couture
San Diego Miramar College
Have you looked at DocBook www.docbook.org/ or www.oasis-open.org/docbook/
I built a site using it for the content some time ago last year. I was working on navigation and layout so I didn't play much with the markup of the content but... It got me thinking about xml vs databases for content.
One could create an entire document contents, forward, chapters, etc... and parse it into an entire website of pages by passing variables that would represent the pages and chapters. I would run it on a webserver and use whatever backend is available to write my editor ASP, PHP or .NET. They all provide degrees of XML support and writing an editor isn't too difficult. Lots of looping though.
I've spend a good deal of time doing something similar with ASP and have ported some of the work to .NET and PHP.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
John J. Couture
San Diego Miramar College
I found the thread that you started some time ago with James Newton and Ken Gracey regarding the index and SXB etc... Great ideas!
If DocBook presents too steep a learning curve, it's not too difficult to create an XML based format for the markup of the (any) book and include sections or chapters etc... for better organizaion.
I would start with something like this:
We could build navigation into it by passing values of the chapter and page to the stylesheet via parameters <xsl: param>.
I'm pretty sure that the HTML writers guild have a project to convert all osrts of writings to XML. They may have a decent format to borrow as well.
Andrew
Hmmmm. This might actually be possible in my lifetime! (grin)
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
John J. Couture
San Diego Miramar College
I just had a look at that XML word creates. It's nasty looking stuff and I think you will need a parser to create the XSL on the fly.
Unless I'm missing something, it's probably going to be easier to build an editor UI that creates a simple XML document based on carriage returns, line breaks and formatting markup than to try to deal with MSXML.
Andrew
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
John J. Couture
San Diego Miramar College
I developed a document content management system a few years ago that merged the power of databases with XML and provided a method to build web based documents (websites) along wih the ability to add and remove sections and pages. The XML document would provide the site/document structure (sections/chapters + pages) and when it was parsed, depending on the XSL, it would produce a website with sections, pages, etc...
Now, I plan to take it to SourceForge and release an improved version without the requirement of a database. I've come to realize that the database is a bit more of a hinderance rather than a benefit of the system. The schema of my system is very close to the xml skeleton I posted earlier. Really simple to mark up in a text editor. The live versions of the sites use built in tools to manage the site framework as well as rich text editors for content + images.
My XML also uses attributes:
ID - May not be necessary
TITLE - Title of page or section
TEXT - The text used in the navigation of the site
Because I was working with web based display I wanted to also allow the navigation to have the ability to leave the framework and access other pages or sites so in my XSL stylesheet I wrote a template that writes hyperlinks outside if there was a value within the XML tag. ie:
I'll send you some URL's of sites that use my XML if you like and perhaps this will give you something to use.
Cheers,
Andrew