XML->HTML
- Started
- Last post
- 8 Responses
- RyanC_BD4D
Hey Kids
Does anyone know how to create HTML pages from XML docs? I've got a database who's contents will be outputted in XML format (for reasons I don't feel like explaining) :) This XML data then needs to be displayed in HTML. We would normailly use PHP to interface with the mySQL databse, but we can't for this app.
- o0o0
where I work we did it with the IE xmldom... so you could basically do it all w/javascript. Load up the xml, and parse through it... but this is IE only, you probably want to be a little more cross-browser compatible...
- sp0
or, you could just write an XSLT document and transform it that way.
it's much easier than writing a bunch of script to take care of it.
XSLT is the stylesheet transformation langauge for XML. you can transform XML into just about anything with it, including but not limited to different XML, XHTML/HTML, text, etc.
- o0o0
that's true, xslt is better, faster. But isn't that IE only also?
- RyanC_BD4D0
Nice one. That gives me a direction to head in. However, we will def need to be cross browser comptible (as it's for a major multinational site).
Isn't XSLT run from the command line, or something? If so, how is that done from the browser?
- o0o0
hm, maybe sp can tell you more..
The way we did it was to create one xmldom object for the xml, and one for the xsl file... then you do
xslobject.transformNode(xmlobjec...
then you display the result of that... all the html tags are in the xsl ... but like I said we were an IE shop...
- chl0
You can use PHP to do XSLT transformations that will put your data into HTML (or whatever else you want.)
- motivdesign0
Yeah, I was just gonna say... PHP has a ton of XML options and you can probably find prefab classes that will do most of what you want.
- RyanC_BD4D0
Nice, one. thanks so much. i'll get crackin on monday.