I have some XML that I\'d like to transform into HTML using a number of XSL files. These XSL files are all related through xsl:import and xsl:include statements, and all require
I would recommend using jquery to import and style the XML.
Something like this would allow you to import the XML whenever a function is called (a function linked to a keypress or a refresh button or even a timer.)
$.ajax({
type: "GET",
url: "FILENAME.xml",
dataType: "xml",
success: function(xml) {
$(xml).find('site').each(function(){ //finds parent node
var id = $(this).attr('id'); //id of parent node
var title= $(this).find('title').text(); //finds title node within parent node
var url = $(this).find('url').text(); //finds URL node within parent node
var description = $(this).find('descr').text(); //etc...
var img = $(this).find('img').text(); //etc...
// Creates div with id of parent node (for individual styling)
$('')
.addClass('add a div class')
//sets css of div
.css({set css})
// Sets the inner HTML of this XML allocated div to hyperlinked 'title' with 'description' and an 'img'
.html(''+title+''+description+'')
// Append the newly created element to body
.appendTo('#holder');
}
}
})
And the XML would look something like this:
http://blah.com
imgs/image1.png
this is a description
Title
http://filler.com
imgs/image2.jpg
this is another description
Title 2
Of course instead of importing to a div you could import the XML to a table or any other type of HTML element.