Skip to content
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

WebBrowser window fails to process href files linked with relative paths #14

Closed
Planet911 opened this issue Jan 28, 2017 · 2 comments
Closed

Comments

@Planet911
Copy link

Planet911 commented Jan 28, 2017

XSL processing can insert href links into the html output, for images, css etc. This works fine in xmlnotepad as long as the href links are fully qualified paths (eg. c:\solarsys\planet9.css) but fails when the links are relative (./../../solarsys/planet9.css)

From a new users perspective, this can be perplexing since relative paths look valid in all xml/xsl files. However, the html output is never 'stored' anywhere other than memory and relative paths have no meaning. Currently the XML is loaded to memory then passed to WebBrowser thus relative paths have no meaning. There seems to be no way to set a 'working directory' for the WebBrowser component.

xmlnotepad could support relative paths by reading href links and loading those files into the WebBrowser DOM. But that is probably a bit of work. Is there an easier way?

Workarounds:
(1) Use fully qualified paths.
(2) Drag and drop your xml file into the xmlnotepad WebBrowser window
(3) Use XSL to copy the content of relative files directly into the html output - described here:
http://stackoverflow.com/questions/1038101/how-to-copy-external-css-and-javascript-in-xslt
For images, they would need to be base64 encoded for embedding into html with Data URI.

@Planet911
Copy link
Author

Actually, solution (2) above got me thinking, why not simply open the xml file with WebBrowser? Clicking the transform button handler would simply be:
webBrowser1.Url = new Uri("file:///C:/temp/test.xml");
Relative paths would be handled correctly.
Is there a downside to that solution?

@lovettchris
Copy link
Member

This should be fixed now. I added a separate "output file name" field to the XSL output tab, it will get an automatically generated file name and by default it will store the output file near the XSL file so relative links now work.
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants