Tuesday, June 5, 2012

Beacon with Google AJAXSLT

I was experimenting with XSL transformations on client side so that we could make Beacon embed-able. 
It will be useful if we can pull this off because
  • it will help us concentrate on the Editor itself and leave the authentication and workflow to the services that would like to use Beacon for editing. 
  • This will also help in easier adoption by various organizations as they won't have to set up a different service and look for ways to integrate their workflow with Beacon's. 

jquery.xslt.js (code here)is a JQuery wrapper around the Google AJAXSLT project which fits in in my opinion because Beacon uses JQuery extensively and Google AJAXSLT gives us a browser independent solution that is essential for Beacon to be adopted. 

I looked at the demo code and set up a similar environment in localhost (basically reusing the template XML and  XSL files the docbook plugin folder of Beacon and CSS and media files from Beacon and placing them under /var/www/html along with the test HTML as below:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html>
 
<head>
   
<title>XSLT Test</title>
   
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
   
<link rel="stylesheet" type="text/css" href="docbook.css"/>
 
</head>
 
<body>
   
<div id="output" style="padding: 2px;"> </div>
   
<script type="text/javascript" src="jquery.min.js"> < /script>
   
<script type="text/javascript" src="jquery.xslt.js"> < /script>
   
<script type="text/javascript">
     (function() {

       // The magic

       $('#output').xslt({xmlUrl:'test.xml', xslUrl:
'docbook2html.xsl'});
     });
   
</script>
 
</body>
</html>


The resulting window looked like the screenshot which was really exciting but I was running into the problem that the text in the paragraphs was missing. I added the XSL template for para as below: 

<xsl:template match="para">
 
    <p title="docbookPara">
 
        <xsl:value-of select="." />
 
    </p>
 
    <xsl:apply-templates />
 
</xsl:template>
 

This fixed most of the problems as shown in screenshots here and here. But now I'm stuck at a rather weird issue. The nested tags don't function properly. Trying to come up with the shortest bit of XSL and XML that show the issue, if my XSL is: 
<?xml version="1.0" encoding="ISO-8859-1"?><xsl:stylesheet>
    < xsl:template match="/">
      <xsl:apply-templates select="para"/>
    </xsl:template>
    <xsl:template match="para">
      <p>
        <xsl:value-of select="."/>
        <xsl:apply-templates />
      </p>
    </xsl:template>
    <xsl:template match="bold">
      <b>
        <xsl:value-of select="."/>
      </b>
    <xsl:apply-templates />
</xsl:stylesheet> 


The XML snippet <para> Hello<bold>World</bold>!</para> results in <p>Hello World!<b>World</b></p> 
I tried to find out on #xml on Freenode, and according to them, < ?xml version="1.0" encoding="ISO-8859-1"?> 
<xsl:stylesheet>
  <xsl:template match="/">
      <xsl:apply-templates select="para"/>
  </xsl:template>
  <xsl:template match="para">
    <p>
      <xsl:apply-templates />
    </p>
  </xsl:template>
  <xsl:template match="bold">
    <b>
       <xsl:apply-templates />
    </b>
  </xsl:template>
</xsl:stylesheet> 
should work but removing the <xsl:value-of select="."/> removes the entire text altogether. Any suggestions on how I can fix this? 

Wednesday, November 2, 2011

Talk at FUDCon.in

After working with JBoss and Drools for more than an year at Red Hat, I am giving my first JBoss talk!

I am giving an introduction to JBoss Drools (An open source Business Rules Integration Platform).

As the expected audience is primarily students, I intend to give them a short background of expert systems, give them an idea about inference engines and their applications in the industry using drools as an example.

As the schedule permits only 40 mins for the talk and 10 mins for Q&A, I'll show them how to make a simple application using drools if time permits.

Being a happy drools user for quite sometime, I really hope I am able to convince people to give it a try :)

Oh and now is the time for the uber-cute FUDCon's Happy Guy!

Tuesday, March 15, 2011

mavu.in

Hi All,

My blog has a new home. I've had the domain for quite sometime and I finally decided I'm going to move and be active. See y'all there!

Monday, August 17, 2009

Demo and packaging done

After some re-assessment of our goals for GSoC, we decided to bring out the standalone version of beacon and continue with the integration later.

I got sponsored for sysadmin-test by Fedora-infra and have set the demo up here. To access it, one needs to create an account on http://publictest3.fedoraproject.org/accounts/ and then use that test account.

Also, I finally managed to get over my packaging blues with some kind help from Rakesh Pandit and have submitted a review request here.

On the whole, this GSoC has been fun (I know the project is not finished yet, but the GSoC phase is coming to a close). This year, it was not as much about GSoC as it was about implementing a product which would be guaranteed in use by the community. I interacted with the community more than last time.

Last but not the least, a heartfelt thanks to a very cool mentor, an amazing upstream (esp. Nandeep), and a very supportive community.

Monday, July 13, 2009

Standalone DocBook editor is ready!

Finally finished the DTD for all the tags :) *phew*

Also added a document tree which helps easy navigation, addition and deletion of elements etc. Please check this feature out here. It is really cool.

Checklist: Deliverable 1 done.

For the other two deliverables,test results and documentation, I have an idea. I will write the documentation in DocBook format using Beacon itself.

Note: Since the demo is still in testing do not trust your documents with it yet. We'll make it stable soon. Better yet, it would be great if community could report bugs/suggestions. :)

Saturday, July 11, 2009

XSLs done!

Finally sent my XSLs to Nandeep for review yesterday. He must have committed it by now.
Also found a DocBook CSS which publican uses and replaced the existing one. Using the same CSS might help in integrating later on.

Will finish the DTD today.

Now off to fill the mid term evaluation form...

Tuesday, July 7, 2009

What's Next

Mid-terms evaluations are knocking on door and its been quite a wild ride coding. Web development is a different ball game altogether and I am beginning to understand why they call JavaScript the world's best worst language :D

After I have spruced the Beacon code and finally finished the DocBook DTD with the initial subset, I am going to start the next big task of getting Beacon integrated with Zikula and Publican for a seamless documentation experience.

It looks like Zikula has some text editors and a plug-in for them. I have to find the best way to get Beacon fit in that work flow. Fortunately Beacon already has a feature that allows one to embed it on any page. So it shouldn't be that difficult.

Am still looking for a best way to get Beacon integrated with Publican. It would be nice if the community can suggest a way to do it.