For whatever reason, I can't get XSLTProcessor() to work all the time.
Here is my JS:
... xsltProcessor = new XSLTProcessor();
xsltProcessor.importStylesheet(xmlRequest.responseXML);
// Pass variables
xsltProcessor.setParameter(null, "sectionNumber", section);
xsltProcessor.setParameter(null, "entryNumber", elementNo);
// Transform XML using XSL
var resultDocument = xsltProcessor.transformToFragment(phonebookDump,document);
// Append to document
document.getElementById('three').appendChild(resultDocument);
Works fine in:
Firefox on OSX,
iPhone Simulator on OSX,
Safari on OSX
Doesn't work at all in:
Mobile Safari on iPhone,
Safari on Windows
Am I missing something? Is there a workaround to XSLTProcessor()? Would server-side XSLT processing be quicker for mobile development anyways?
Your JS code seems right. Safari (and safari mobile as well) acutally has the xslt support. It's just a merciless implementation. The problem is that sometimes it may look like it is not working just because it is not verbose at all when it fails.
Remember that webkit xsl engine is based on libxsl, so you can use any software based on this library to test your style sheet against your document. I personally use xslproc that fails just like safari, but gives much more output.
If you can't get out of the problem, just post the xslt and the XML files.
I'm pretty sure Mobile Safari doesn't support XSLT, as the underlying OS X implementation does not include the relevant libraries that are present in desktop versions of OS X.
Server-side processing would definitely be quicker for a mobile app anyway: any processing you can reasonably shift away from the phone to the server is a win.
Related
I am creating an PhoneGap application for iPhone.
When I am designing and testing HTML file in PC-Browser it looks different.
And In Phone gap it looks different.
Actually CSS not functioning as accepted. Is this known issue? OR Am I missing something?
I can provide code snippet or screen-shots if needed. Please help
Without seeing code this is almost impossible to actually answer. BUT I will say this - with mobile you are using Webkit, meaning that anything in your CSS that referes to -moz- will not work. Also, you're dealing with a version of webkit, not the newest, and not the oldest - well that is unless your on android 2.2.2
You should be safe to use any -webkit- syntax in your CSS, but just know that certain properties may not be supported in android as they have fragmented their phones quite and bit and have shipped a somewhat old version of webkit with specific OS's.
iPhone you should be all good to go, now if you continue to have issues that are more specific I would recommend you post your code so we can see what is going on - you could just have some weird markup somewhere.
Has anyone successfully used WebKit in Delphi?
WebKit is an open source web browser engine. WebKit is also the name of the Mac OS X system framework version of the engine that's used by Safari, Dashboard, Mail, and many other OS X applications.
I want to create an iPhone/iPad Mobile Simulator same as in electricplum. (I have tried the FREE version - seems like it also uses Adobe AIR).
With Safari browser we have the most accurate preview results for iPhone mobile sites. so I would like to embed the WebKit (that is used by Safari) in my application, so my customers can have a reliable preview of their mobile web sites.
I have searched the web, but could not find a working code. (The best I could find was this, but it's not working).
The 3 main problems with Delphi Chromium Embedded suggested in the answers are that:
It does not support D5
I can overcome the fact that there is no support for D5 (creating the component with D7 in a separate process or DLL) But, It is very unstable! I have tested it with D7: Random access violations.
It does not render HTML pages with div layout/HTML5 same as Safari does (or electricplum - "Electric Mobile Simulator").
Have a look at DelphiChromiumEmbedded. It's not Safari, but it is Webkit based at least...
The reliability of that is not going to be very good. In a corporate environment you might want to just put a mac on the network with the iPad/iPhone simulator from xcode, and script it to open your site and take screenshots.
Or even write a iOS program to open a webkit view with your site, and just put an iPad on the network.
Taking a screenshot
Open a webpage
Running in the background
Sending mail directly through smtp
And take a look at this question and answer
You might want to consider how much work a delphi webkit is going to be compared to just buying a mac. The upgrade cycle is going to be painful whatever route you take, but quality is going to be much better with the mac/iPad.
I have a software that eventually will have some reports to be accessed via iPhone.
Once I am not willing to develop an iPhone app, I´d like to make these reports accessible via iPhone Safari browsers.
GMail in iPad uses HTML 5, so I guess I can do the same.
My question is where can I find some resources to learn best practices doing so and how can I test it in a PC computer.
Thanks
Here is a similar answer I've given: Exclusive CSS for iPhone/Android
For testing you can use Chrome or Safari, as they are both webkit browsers (which is what the iPhone uses). Safari can even render as the iPhone user agent.
Hope this helps.
Please take a look at PhoneGap, I think that is what you are looking for.
You can emulate the program in xCode, but you will need an Apple for that. For PhoneGap also..
From the app architecture view-point you should also consider introducing app-specific optimization such us:
Simplify the app (show only what you need for mobile)
Minimize Application and Data Size
Aggregate Images into a Single Composite Resource (Sprites)
Include Background Images Inline in CSS Style Sheets
Keep DOM Size Reasonable
Ensure Paragraph Text Flows
Avoid Redirects
On the Mac I got the iPhone Simulator but under Windows and Linux enviroments I need a webbrowser which emulates the behaviour and size of the iPhone browser. I'm not looking for a website with a frame with the iPhone screen size but an actual application. Prefably webkit based so it will behave as much like the iPhone as possible. It should also be able to send the same browser headers as MobileSafari in the iPhone and if not it should be possible to modify the headers. That could be done in a menu in the program, support plugins(which have the power to modify headers) or the progam should be opensource.
It might not exist and if not thanks anyway. However if it does that would be awesome. If you know a program which have some of the mentioned features but not all of them an no one have posted a better one feel free to post a link/the name of that browser (still better then nothing or a framed site in Safari).
tldr: iPhone like browser, same window size and headers as MobileSafari.
Try one of the following:
Blackbaud iPhone Browser Simulator
iPhone Drift web browser for Windows
MobiOne iPhone and Palm Pre emulator
So far as I can see, only the first of these actually uses Safari as the rendering engine, and it is using Safari for Windows rather than Mobile Safari, but it should be close enough I think.
try iphonedrift on windows
I have got a assignment to develop a IPhone application in HTML 5 & I really don't have any idea from where I have to start.
Please let me know which editor I have to use to develop IPhone application in HTML 5.
also, as I am a pure .NET developer, what other skills I need to write the program in HTML 5.
Thanks in advance.
When they say develop an iPhone application in HTML 5, what they are really saying is develop a web application that fits in the dimensions of an iPhone. So you do not need to know any Apple centric technologies. You can use your ASP.NET/HTML/Javascript/CSS skills.
If you need any rich interactions in your app, you will then need to use HTML 5 with the canvas element. I recommend using the library Processing.js which makes working with the canvas element much easier.
HTML5 isn't that different from HTML. For a great resource, check out Apple's developer site. Here's the section on Safari: http://developer.apple.com/safari/.
In terms of what editor you should use: You can use whatever editor you want! Notepad for Windows works fine ;) On the Mac, I prefer Coda or Textwranger. Dashcode will work too! In order to write HTML5, you just need to know HTML, CSS and Javascript (jQuery would help too).
And, what's more, since this is just HTML, don't forget you can test it in the browser on your desktop before you test on the iPhone or the iPhone Simulator (included in Xcode). I'd recommend testing in Safari first and Google Chrome second.
Good luck and welcome to the wonderful world of HTML5 and iPhone development!
Please let me know which editor I have to use to develop IPhone application in HTML 5.
Any you like. I usually go to Komodo Edit.
What other skills I need to write the program in HTML 5.
HTML, JavaScript and DOM are key, along with the new JS APIs introduced in the HTML 5 Drafts. CSS is all but essential and you'll probably want some skill at graphics editing. SQL will be useful if you want to use a database.