SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot
    Join Date
    Oct 2006
    Posts
    153
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    A JavaScript function that will change XML style sheets please?

    Hi
    I've been trying to make a Firefox extension and I am finding a need for a style sheet switcher. I have found several sites that will give you stylesheet switches for HTML, XHTML, but not XML. When I search for an XML stylesheet switcher I'm getting information on XSLT. Which I do not want to use at this time. I want the stylesheet switcher to be a JavaScript function since I know how to evoke functions with XUL menu overlays the form of XML used to create Firefox extensions. I'm not looking for somebody here to know XUL. I would just like a function which you know would work with XML to try in my XUL form of XML to see if it will work. A link that would give me this function or information on how to write it would be good to. I am a newbie to both XML and Firefox extension writing. I spent all they reading about XML hoping it would give me the answer but it didn't. I have seen some information which seems to say that XML as similar stylesheet capabilities to HTML so I know that. I need the stylesheet switcher please help.
    Sincerely
    Marc

  2. #2
    SitePoint Zealot Gharibe's Avatar
    Join Date
    Sep 2007
    Location
    NY | US
    Posts
    138
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    http://kelvinluck.com/article/switch...ts-with-jquery

    Or google > "stylesheet switcher"

  3. #3
    SitePoint Zealot
    Join Date
    Oct 2006
    Posts
    153
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    OK -- well maybe I articulated the above question very poorly and maybe this is really a question for the XML forum. But perhaps someone here could answer it if I could manage to be clearer or at least help me articulated better for the XML forum. A XML stylesheet declaration does not have a rel attribute in its link stylesheet( or maybe what is the equivalent to its linked stylesheet.) I'm not even sure if an XML link type declaration is considered an element in the DOM. Let me post what I have seen at a W3C site in regard to the equivalent of a link stylesheet in HTML.


    Multiple xml-stylesheet processing instructions are also allowed with exactly the same semantics as with LINK REL="stylesheet". For example,

    <LINK rel="alternate stylesheet" title="compact" href="small-base.css"
    type="text/css">
    <LINK rel="alternate stylesheet" title="compact" href="small-extras.css"
    type="text/css">
    <LINK rel="alternate stylesheet" title="big print" href="bigprint.css"
    type="text/css">
    <LINK rel="stylesheet" href="common.css" type="text/css">

    would be equivalent to:

    <?xml-stylesheet alternate="yes" title="compact" href="small-base.css"
    type="text/css"?>
    <?xml-stylesheet alternate="yes" title="compact" href="small-extras.css"
    type="text/css"?>
    <?xml-stylesheet alternate="yes" title="big print" href="bigprint.css"
    type="text/css"?>
    <?xml-stylesheet href="common.css" type="text/css"?>
    as seen at http://www.w3.org/1999/06/REC-xml-stylesheet-19990629/

    And at another site reading about XML it stated that the XML declaration"<?xml version="1.0"?>" is not an element so I do not know if those "?" next to the less than and greater than signs make the XML version of what is the equivalent of stylesheet links something other than lement links which can be accessed with the DOM. Which means the common switch style sheet functions you find with a Google search won't work since you cannot get or set the rel attribute because it does not exist. And I do not know if those style switching functions that loop through all the link elements on a page are looking through something which can be loop through in XML in quite the same way or at all. So please help me either articulate a question that would make sense to an XML expert or just direct me on how to get an JavaScript function that would be a stylesheet switcher for XML.


Bookmarks

Posting Permissions

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