Jump to content

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


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 post
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 post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...