XSL on XML Transform Issue Occurs Client Side on Android Device

After uploading the NIM Pocketnotes On The Go app on the Google Play Market, I had a fellow co-worker try it out on their Droid X phone. I had tested the app on my husband’s Motorola Xoom tablet which I had handy and everything was working fine. When the app rendered the Pocket Notes on the Droid it looked AWFUL. All the text was jumbled and there was no text formatting being done. Uh-oh, not good.

A quick google brought up the Is the Android Browser capable of performing an xsl transform on stackoverflow. The answer at the bottom of the page was:

The default Android Browser starts supporting xsl transforms in the version that shows up in Android 4.0, Ice Cream Sandwich.

I quickly realize the Xoom has an Android OS 4.0 or higher and the Droid X has an Android OS of around 2.3. Buggers.

The initial Pocketnotes On The Go App implementation used a live http request to our website at nutritioninmedicine.net. The user would select a course from the list in the app, a request would be made for the html page to display and the site would return an html formatted page. The returned html formatted page was rendered using php that requested an xsl transform on an xml file.

After reading an item on the cultcreative blog site called Local File Access/ Editing for Android and IOS, I had modified the app so if there was no internet connection available, the app would still work by loading a local xml file and using an xsl transform on the client side (ie – the device) to create an html page to be displayed in the browser.

It seemed like a good idea at the time and worked when I was debugging on the Xoom and in the debugger simulation for all the devices. The simulator was run on my pc which has a browser which supports XSLT transformation so there was no red flag indicating there may be a problem.

Back to the drawing board. Did another quick google and found an actionscript developer that had written a class that allowed an app to detect the device properties on AIR for Android. One of the options was for the android os version. Lifesaver!

Using the actionscript class in my app, I was able to detect the android OS version. If the OS version was before 4.0, I requested the details from the website (con – if the user had no internet connection or the website was down,no details will be displayed). If the OS version was 4.0 or greater, I used the local files to display the pocketnote details which would work in all scenarios – with or without an internet connection. The implementation details are discussed in Testing for the Android OS version using Actionscript 3.0.

Leave a comment