/    Sign up×
Community /Pin to ProfileBookmark

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

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@MarcMillerauthorDec 15.2007 — 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"?>
[/quote]

as seen at [url=http://www.w3.org/1999/06/REC-xml-stylesheet-19990629/]http://www.w3.org/1999/06/REC-xml-stylesheet-19990629/ [/url]

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

Success!

Help @MarcMiller spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.23,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...