[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
Hi Antsnio,
See my intermissions,
Antsnio Mota wrote:
This should be right, yes.
This should be right too. But I'm afraid it will work with TransformIIX (Gecko based browsers use it) and not with MSXML. I had about the same problem a while, but I wasn't using Sarissa (but I am planning on using it).
It should work for both with any "normal" processor. But since you are using Sarissa, I expect you to use the XSLT as a client-side transformation in JavaScript. This changes the original question a bit, because there are a lot of incompatibilities between client side XSLT processors. Here's a copy of my function that does what you want. Put in a DOM element and a tagname. The tagname can be of the form "xs:element" or otherwise. It will replace the prefix for Gecko based browsers. There are other ways to do this, but this is a working version (and your post reminds me of adding some error handling in the function below). .
getElementsByTagName = function(dom, tagname) {
if(typeof dom.selectNodes != 'undefined') {
return dom.selectNodes("//" + tagname);
} else {
tagname = tagname.replace(/[^:]+:(.*)/, "$1");
return dom.getElementsByTagName(tagname); }
}
Please note that, if your DOM object is obtained using AJAX technology outside the domain, you may need to request UniversalBrowserRead privileges for Gecko. In that case add the following to the "else" part (for IE, you must add the site to the trusted domains):
try{typeof netscape!='undefined' && netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
} catch (e) {alert("Not allowed by user!" + e.message); return }
Afaik, this should do the trick. Hmm, thinking. You should try this with a DOM object that is not expanded by Sarissa. Try it without Sarissa first.Then add this code in a way to Sarissa, so that it works for the Sarissa method "selectNodes".
Re: [xsl] Namespace prefixes in Schemas
Subject: Re: [xsl] Namespace prefixes in Schemas From: Abel Online <abel.online@xxxxxxxxx> Date: Wed, 16 Aug 2006 11:59:17 +0200 |
Hi Antsnio,
See my intermissions,
Cheers, Abel Braaksma http://www.nuntia.nl
Antsnio Mota wrote:
Are you sure of that? Are you sayng that the target, not the prefix, is cheked by the processor?
But nevertheless i lied about my actual problem, (gee, i'm watching too much "House") cause i was afraid that the moderator will come by saying this is not a XSL question... But i'll risk it anyway...
My problem is that i'm using Sarissa to get some Schema nodes using XPath, like this
var nodes = xmlSchema.selectNodes("//xs:element");
This should be right, yes.
after declaring
Sarissa.setXpathNamespaces(xmlSchema, 'xmlns:xs="http://www.w3.org/2001/XMLSchema"');
This should be right too. But I'm afraid it will work with TransformIIX (Gecko based browsers use it) and not with MSXML. I had about the same problem a while, but I wasn't using Sarissa (but I am planning on using it).
It seems that this is about the same situation you've pointed in your answer, but that is not working, afaict it only works if the Schema has
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
but not if it's
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
It should work for both with any "normal" processor. But since you are using Sarissa, I expect you to use the XSLT as a client-side transformation in JavaScript. This changes the original question a bit, because there are a lot of incompatibilities between client side XSLT processors. Here's a copy of my function that does what you want. Put in a DOM element and a tagname. The tagname can be of the form "xs:element" or otherwise. It will replace the prefix for Gecko based browsers. There are other ways to do this, but this is a working version (and your post reminds me of adding some error handling in the function below). .
getElementsByTagName = function(dom, tagname) {
if(typeof dom.selectNodes != 'undefined') {
return dom.selectNodes("//" + tagname);
} else {
tagname = tagname.replace(/[^:]+:(.*)/, "$1");
return dom.getElementsByTagName(tagname); }
}
Please note that, if your DOM object is obtained using AJAX technology outside the domain, you may need to request UniversalBrowserRead privileges for Gecko. In that case add the following to the "else" part (for IE, you must add the site to the trusted domains):
try{typeof netscape!='undefined' && netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
} catch (e) {alert("Not allowed by user!" + e.message); return }
Afaik, this should do the trick. Hmm, thinking. You should try this with a DOM object that is not expanded by Sarissa. Try it without Sarissa first.Then add this code in a way to Sarissa, so that it works for the Sarissa method "selectNodes".
Good luck with it, hth,
Anyhow i'm going to try this in a XSLT "per se", not in Sarissa, to see if it works (the moderator...) and if it works i'll check with the guys at Sarissa (if Manos don4t answer to this post first).
Thanks for your answer, it didn't solve my problem but it pointed me to right direction, i think...
Abel Braaksma http://www.nuntia.nl
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Namespace prefixes in Sch, Michael Kay | Thread | Re: [xsl] Namespace prefixes in Sch, António Mota |
RE: [xsl] Namespace prefixes in Sch, Michael Kay | Date | [xsl] <xsl:template match="and"> do, Ralf Schumann |
Month |