Here I am attaching original requirement.
Here is how it works:
Open any TokenScript, for example, this one:
https://github.com/AlphaWallet/TokenScript-Examples/blob/master/examples/EntryToken/EntryToken.xml
Find the and in them. Like this:
<ts:view xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<style type="text/css">&style;</style>
<script type="text/javascript">&token.en;</script>
</ts:view>
Observe that an view (or item-view) are made up of 3 sections:, and , all are optional.
Do XSLT to transform the TokenScript file into an HTML that: for each
view and item-view, create an iframe for it. and fill the iframe
(using JavaScript) with a virtual HTML that has a header which
includes the view's and , and a body which has what is
in the view's .
For example, the above TokenScript file will result in an HTML file that has 3 in it.
Furthermore, your XSLT needs to run in the latest browser. That is, if a user double-clicks the TokenScript file on their desktop, they see the .
The purpose of this is to give developers a way to debug views and item-views. This way, if a developer changes a line in the included , he doesn't have to load the TokenScript on a mobile phone; instead, he can double-click it and see it open in a browser and see his CSS change applied.
That's the 1st phase of this project. I will have more requests once you made this but I prefer to do this project phase by phase.
Based on requirement Here I have committed the initial version of the debugger: https://github.com/darakhbharat/TokenScript-debugger
This is ready for the trial and one can try on Chrome after below mentioned settings. Another option is running the local HTTP server
But simple and quick option is Adding --allow-file-access-from-files to the properties of Chrome.exe. This worked for me on windows 7
Details - https://stackoverflow.com/Questions/3828898/can-chrome-be-made-to-perform-an-xsl-transform-on-a-local-file
Steps: Right click on Chrome icon > Properties > Apply above property after chrome.exe in target field as shown below.
"your_path\chrome.exe" --allow-access-from-files
Firefox behaves same as Chrome, both are from the same family, but did not checked for its workaround yet.
We can make use of this post for feedback and improvements in debugger.
Thanks,
Here I am attaching my local Chrome screen shot for - EntryToken.xml
As per discussion with Weiwu changed the debugger view to add item-view for and it can be compared side by side with its .
Improved the debugger UI and added expand collapse features to card container. Refer below screen shot.
Right now I have assumed that element will appear after the its element in the xml, Let me know if there is specific condition to identify corresponding view and item-view.
Find the latest code here - https://github.com/darakhbharat/TokenScript-debugger