Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2003

    Very basic XML/CSS question

    How can I write a CSS stylesheet for the code below that results in the text being displayed in a different font and color?

    I know how to write CSS stylesheets, and I know how to change text/color. What I don't know is how I'm supposed to incorporate that to work with this XML file. Should the stylesheet be in a separate XSL file? That's hat I'm confused about, I'm not sure how to link them. I know CSS fairly well. Please advise.

    PHP Code:
    <?xml version "1.0"?>

    <!-- Fig. 5.1 : intro:xml              -->
    <!-- Simple introduction to XML markup -->

        <message>Welcome to XML!</message>

  2. #2
    Join Date
    Apr 2004
    To link to a CSS style sheet in XML use

    <?xml-stylesheet type="text/css" href="style.css"?>

    Then for you use this:

    mymessage {


    message {


    For XML tags you put the name of tag as if it were an HTML tag. Hope that this helps. Here is a good tutorial on it too:

  3. #3
    You can do formating job with CSS, but in a real life people use XSLT and XSL-FO for formating XML documents in this context.

    Open Solution, Inc

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts