Take the 2-minute tour ×

I know how to design and structure an entire HTML page to create a product catalog. I just thought for formal practices, it would be better to store product information in a XML file. Except I don't know how to link the two. What is the standard way of displaying XML information within a HTML webpage?

I have a list of products, each with their title, image, description, and add to cart button. I want to know how to display the proper XML product data within the HTML list.

I saw a good example of databinding or something, but later found out it is deprecated. So what is the normal procedure people use now? How do people show external information in HTML webpages in the most secure, and efficient way?

share|improve this question
You will need jquery to do that. –  sємsєм Nov 16 '12 at 0:01
add comment

1 Answer

To transform your XML into HTML you can use an XSLT style sheet and some process to apply the transform.

To select data from XML you will need to employ XPATH selectors to grab the data or collection of data you want to transform.

The coding of the XSLT file can become quite complex in the way that it selects data from your XML file and the options for rendering are far reaching.

Here is the example from W3Schools: XSLT - Try It Yourself, they also have a XSLT Tutorial

You can certainly also use JavaScript for XML to HTML but the code will be more complex and much less flexible.

Getting the initial concepts around XSLT and XPATH may take a bit longer but will pay off in the end.

share|improve this answer
Hi, thank you very much for writing back to me. I was wondering what is a good option to integrate the XML data into the HTML page, rather than changing the XML to look like the HTML/CSS page I already have. What is the standard procedure for doing that? –  trixmasta Nov 22 '12 at 21:04
Hi trixmasta, I'm not sure I understand what procedure you want. With the data values in XML you want to render them on the page with HTML? Your procedure must select the data values from the XML and then produce some HTML. The links in my answer give you two ways to do this; XSLT transform or JavaScript iteration. Perhaps if you include an example of what you want to do then it will be clearer? –  Dave Anderson Nov 23 '12 at 1:41
add comment

Your Answer


