Jump to content

How to format xml elements using xsl. (And then can that be imported into html?)


Ag-Chieve

Recommended Posts

Hi, I noticed in the tutorials that it explains how to use xslt as stylesheets for an xml document. And while it talks about how to get various components to display depending on what parameters you put on them (being greater than, less than something) or getting them to show up in a table, it doesn't seem to touch on how to actually format the content (like what colour to display the font in). Is changing the font colour of an xml element something I can do with xslt? What I'm trying to do is import xml element contents into an html page (specifically a <div> on an html page) but because the background colour of the page is black, I the font of the element contents needs to be white. So, can I make an xml that links to an xslt that says to change the font to white and then import the xml elements into the html document? Would that work? I realize all this can be difficult to answer without seeing the code and that can be provided if necessary. Thank you.

Link to comment
Share on other sites

You need CSS for that. Or to be more precise, you need to use XSLT to generate HTML, which would in turn reference a CSS file.If you don't know CSS already, check out the CSS tutorial and pracice a little over some plain HTML files before you move on to apply it on an XSLT generated HTML.If you already have an HTML page, you could trigger XSLT from it using JavaScript, and insert the result somewhere on the HTML page. From that point on, the HTML page's CSS will take care for the styling.

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...