Timbats1993
Timbats1993

Reputation: 65

Embed XML code (styled with XSL) IN HTML

Just wondering if anyone could help me out here. I have a HTML document that needs to include information from an XML file. I would like to display this information as styled by XSL. I've tried a few different things, but have not being able to acheive this. The closest that I got to getting the xml information to show was by psychically putting my xml information into the html document using the tag. Of course, this information came up as unstyled. When I view the XML document on its own, it is showing correctly styled

Can anyone think of an easy way to get the xml information (as styled by XSL) into a HTML document?

Upvotes: 4

Views: 642

Answers (1)

Martin Honnen
Martin Honnen

Reputation: 167516

Use an iframe element in your HTML document where you want to display the styled XML document e.g.

<body>
  ...
  <section>
    <h2>Information</h2>
    <iframe src="file.xml"></iframe>
  </section>
  ...
</body>

You can define the dimensions of the iframe element of course using its attribute like width and height and additionally CSS.

Upvotes: 1

Related Questions