Jump to content

Displaying XML in HTML


jmfekete

Recommended Posts

Use XSLT. If you don't have a server side scripting language, you can use this JavaScript to execute the transformation from within the (X)HTML page.
Alright, I don't mind using javascript, but this is how the system works.From my local machine, the index.html page has 2 text fields where the user enters 2 criteria to do a search on and clicks on the submit button to perform the search.By clicking on the submit button, it then passes the 2 fields to the web server that calls upon an ASPX page to perform the search, which then creates an XML file.What I want to do is instead of having it display the XML file to the user (because they won't understand what's going on), I want it to automatically redirect to and HTML page which calls upon elements within the XML to display the results on the page.Keep in mind, I do not have any control over what happens from the point the user clicks on the submit button in index.html until the XML file is created and displayed.Kinda tricky but i can just be overcomplicating things like usual.Thanks!
Link to comment
Share on other sites

Well, in that case, you can't do anything without a server side script. JavaScript can only be executed on the same domain. There are only 2 other ways to initiate an XSLT transformation:1. Call it from the XML file. This (I think) works across domains, but scince you don't have control over the creation process, you can't do that.2. Use a server side script's XSLT processor. Server side scrips can fetch files across domains and you're the one in control. However, your server is requred to have server side scripting support.The only client side way I can think of is this trickery:Use the JavaScript above with any XML and an XSLT that processes the remote XML by using the document() function. An important thing to note is that this doesn't work in Opera 9, even though it otherwise does have XSLT support.

Link to comment
Share on other sites

OK, I've used the code an inputted it into my HTML file to retrieve the data from an XML file on my local machine, which is working beautifully, but now i need some direction on how to specify the XML source that's not locally on my machine. Instead it is on a web server that I access externally.How would I do that? I'm sure these questions are kind of dumb, but they didn't teach me this in college! I've searched the forum but haven't come across anything that could help me.Thanks!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...