Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Feb 2003
    Posts
    17
    Thanks
    0
    Thanked 0 Times in 0 Posts

    CSS style sheets in XML - Is it possible

    I wat to apply CSS style sheet attributes to an XML file is this possible or do I have to write a seperate XSLT sheet for modifying style in an XML file


    thank you in advance

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    near Oswestry
    Posts
    4,508
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You don't have to, but XSL is far more powerful; what you can do with CSS is more limited, even with CSS3.

    Nonetheless - w3schools have an example of an XML doc processed with CSS - it's pretty much the same as processing HTML, except that no styles are implicit - you have to specify everything. Have a look at http://www.w3schools.com/xml/xml_display.asp
    "Why bother with accessibility? ... Because deep down you know that the web is attractive to people who aren't exactly like you." - Joe Clark

  • #3
    Moderator
    Join Date
    May 2002
    Location
    Hayward, CA
    Posts
    1,461
    Thanks
    1
    Thanked 23 Times in 21 Posts
    The <?xml-stylesheet ?> processing instruction works almost identically to the HTML 4 LINK element. If you know how to set that element's attributes, then use the same format for the processing instruction, with "pseudo-attributes".

    For CSS, you'd use:

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

    XSLT and CSS are really intended for different purposes. XSLT is to transform one XML language into another (usually into XHTML). CSS is to style the appearance of the XML document.
    Last edited by Alex Vincent; 04-26-2003 at 02:14 AM.
    "The first step to confirming there is a bug in someone else's work is confirming there are no bugs in your own."
    June 30, 2001
    author, Verbosio prototype XML Editor
    author, JavaScript Developer's Dictionary
    https://alexvincent.us/blog

  • #4
    New Coder
    Join Date
    Feb 2003
    Posts
    17
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you both so much for the great insights

    nibs

  • #5
    Master Coder
    Join Date
    Feb 2003
    Location
    Umeå, Sweden
    Posts
    5,575
    Thanks
    0
    Thanked 83 Times in 74 Posts
    Originally posted by brothercake
    You don't have to, but XSL is far more powerful; what you can do with CSS is more limited, even with CSS3.
    Hmm, if I'm not mistaken, XSLT is not at all a styling language, but a transformation language. if you want to use XLS for styling, you need to look into XML-FO.

    However, XLS-FO destroys a document's semantical and structural meaning, changing it to pure style, while css allows the nice combination of a preserved semantical structure while styling a document.


    Then we have the bindings languages, HTC/Behaviors, and XBL. Those are not standard, but allows for something that could be called "non-destructive transformation" or "expansion" and styling through regular means (css).
    Last edited by liorean; 09-02-2003 at 07:47 PM.
    liorean <[lio@wg]>
    Articles: RegEx evolt wsabstract , Named Arguments
    Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
    Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards


  •  

    Posting Permissions

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