-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
error when loading dai-debt.xml #1
Comments
Yes we can do that I kept it separate for code readability. Letter if we
include more debugging feature the code may extend.
…On Fri, Aug 7, 2020 at 11:24 AM Weiwu Zhang ***@***.***> wrote:
Access this page:
https://alphawallet.github.io/TokenScript-Examples/examples/AAVE/debt-dai.xml
Observe the IFRAMEs are empty and there is an error
Uncaught ReferenceError: loadIframe is not defined.
Workaround:
I put JavaScript inside the xslt file:
<script type="text/javascript" charset="utf-8">
//<![CDATA[
function loadIframe(){
var iframes = document.getElementsByTagName("iframe");
for(var i=0; i<iframes.length; i++){
var iframe = iframes[i];
var textContent = iframe.textContent;
var wrapper = document.createElement('div');
wrapper.innerHTML = textContent;
iframeContentDocument = iframe.contentDocument || iframe.contentWindow.document;
iframeContentDocument.write(wrapper.innerHTML);
iframe.textContent = "";
}
}
//]]>
</script>
Do you accept this as a solution?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#1>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AE47O3KYVZDUTKHJTLX5W2DR7OJJ7ANCNFSM4PXJD75A>
.
|
Does entity reference work in XSLT file? I think it might does. If it does, you should be able to
I'm not sure if entity dereference works on the web, but if it does, it would be great. |
Hi Weiwu,
1. Above issue is already resolved. no need of using entity reference for
that. Here is the solution.
```
<script type="text/javascript" charset="utf-8">
<![CDATA[
function loadIframe(){
var iframes = document.getElementsByTagName("iframe");
for(var i=0; i<iframes.length; i++){
var iframe = iframes[i];
var textContent = iframe.textContent;
var wrapper = document.createElement('div');
wrapper.innerHTML = textContent;
iframeContentDocument = iframe.contentDocument ||
iframe.contentWindow.document;
iframeContentDocument.write(wrapper.innerHTML);
iframe.textContent = "";
}
}
]]>
</script>
```
2.
Tried to run the XSLT debugger on Firefix but the XSLT engine of FF does
not understand the entity reference where as Chrome's XSLT engine
understands it.
i.e. Below code fetches the HTML content from the file debt-table.en in
Chrome but not in FireFox, So there is no content to write to iframe in
case of FF.
XSLT:
```
<xsl:for-each select="html:body">
<xsl:copy-of select="."/>
</xsl:for-each>
```
XML:
```
<body>
&debt-table.en;
&credit-table.en;
</body>
```
FF has below settings like Chrome to run the XSLT locally.
i. Type about:config in adress bar and hit Enter key. Accept the warnings.
ii. search - privacy.file_unique_origin and turn this to false.
I am still checking ways to make it work on FF, Chrome seems best till then.
Thanks
…On Fri, Aug 7, 2020 at 4:13 PM Weiwu Zhang ***@***.***> wrote:
Does entity reference work in XSLT file? I think it might does. If it
does, you should be able to
1. Save a .js file with the following:
//<![CDATA[
function loadIframe(){
var iframes = document.getElementsByTagName("iframe");
for(var i=0; i<iframes.length; i++){
var iframe = iframes[i];
var textContent = iframe.textContent;
var wrapper = document.createElement('div');
wrapper.innerHTML = textContent;
iframeContentDocument = iframe.contentDocument || iframe.contentWindow.document;
iframeContentDocument.write(wrapper.innerHTML);
iframe.textContent = "";
}
}
//]]>
```
2. refer to them as an entity inside the `<script>…</script>`?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#1 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AE47O3ILD3LW46NTBI65XG3R7PLEPANCNFSM4PXJD75A>
.
|
Which is true?
Yeah, will try to get by with Chrome for now. FYI we will not always be using entity references - we wanted to allow either entity reference or Object/Manifest since 1.5 years ago but never got around to implemente support for loading views from there. |
Hi Weiwu,
As per my initial findings, in a way both seems true in case of FF while
dealing with XML files. I will update you if I found more information.
You can also check this link -
https://bugzilla.mozilla.org/show_bug.cgi?id=69799
1. When I loaded XML without styleSheet(XSLT), the <style/> and <body/> are
empty. that means it ignored those entity references. See the highlighted
part in below image.
*FF browser:*
[image: https://user-images.githubusercontent.com/20576109/89681057-ccb05100-d911-11ea-92a3-3e8554c9a869.png]
2. When I loaded XML with styleSheet(XSLT), the result was the same, and
Network tab also did not loaded those external files. *But here Chrome's
behaviour is different and loaded those external files.* You can also see
the same in the Network tab.
*Chrome browser: *
[image: https://user-images.githubusercontent.com/20576109/89681176-084b1b00-d912-11ea-956b-187868377f8b.png]
Thanks,
…On Fri, Aug 7, 2020 at 6:34 PM Weiwu Zhang ***@***.***> wrote:
FF has below settings like Chrome to run the XSLT locally.
Which is true?
- FF categorically doesn't recognise entity reference ;
- FF doesn't recognise entity reference when it's served on the web.
I am still checking ways to make it work on FF, Chrome seems best till
then.
Yeah, will try to get by with Chrome for now. FYI we will not always be
using entity references - we wanted to allow either entity reference or
Manifest since 1.5 years ago but never got around to implemente support for
loading views from Manifest.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#1 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AE47O3II4BNJYYYYJUAO2STR7P3VVANCNFSM4PXJD75A>
.
|
Hi Weiwu, The original issue 1 here is resolved and committed changes to - https://github.com/darakhbharat/TokenScript-debugger Now you only need to take ts-debugger.xsl file which also has required JS code. Now regarding FF one more stackoverflow thread says that right now external entity not supported in FF. |
Access debt-dai.xml
Observe the IFRAMEs are empty and there is an error
Uncaught ReferenceError: loadIframe is not defined.
Later I realised that the debugger assumes the JS fiel to be in the same places as the TokenScript XML file, while I put the debuger (both xsl and js files) into a subfolder, hance the
<script src="…"
didn't work.Suggested workaround:
In this version:
https://alphawallet.github.io/TokenScript-Examples/examples/AAVE/debt-dai.xml
I put JavaScript inside the xslt file:
Do you accept this as a solution?
The text was updated successfully, but these errors were encountered: