473,385 Members | 1,856 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

XSL - problem finding CSS file, pictures etc.

I have a piece of code that looks like this:

XPathNavigator l_nav =
xml_document.DocumentElement.CreateNavigator();
XslCompiledTransform l_xslt = new XslCompiledTransform();
l_xslt.Load(xsl_document_location);
l_xslt.Transform(l_nav, null, output_stream);
//l_xslt.Transform(l_nav, null, new
StreamWriter("TRANSFORMED.html"));

I have a link to a css document in the xsl code. If I uncomment the last
row, which stores the transform into a file, the file TRANSFORMED.html is
created and it looks just fine with the CSS styles applied. But if I only use
the line above and keep the resulting translation in RAM the css styles are
NOT applied when sending the translation to a
System.Windows.Forms.WebBrowser, even though I have put the CSS file just
about everywhere. What am I doing wrong? Can't the web browser resolve the
file? Do I have to give the file in some way to the WebBrowser? It that case
- how do I do that?
Aug 10 '08 #1
1 1915
"Joachim" <Jo*****@discussions.microsoft.comwrote in message
news:B2**********************************@microsof t.com...
I have a piece of code that looks like this:

XPathNavigator l_nav =
xml_document.DocumentElement.CreateNavigator();
XslCompiledTransform l_xslt = new XslCompiledTransform();
l_xslt.Load(xsl_document_location);
l_xslt.Transform(l_nav, null, output_stream);
//l_xslt.Transform(l_nav, null, new
StreamWriter("TRANSFORMED.html"));

I have a link to a css document in the xsl code. If I uncomment the last
row, which stores the transform into a file, the file TRANSFORMED.html is
created and it looks just fine with the CSS styles applied. But if I only
use
the line above and keep the resulting translation in RAM the css styles
are
NOT applied when sending the translation to a
System.Windows.Forms.WebBrowser, even though I have put the CSS file just
about everywhere. What am I doing wrong? Can't the web browser resolve the
file? Do I have to give the file in some way to the WebBrowser? It that
case
- how do I do that?
This is not really a C# problem. However the issue will be that the path
of the CSS file will be relative. Ordinarily a web browser will use the
documents URL as basis to resolve relative URLs it finds inside it. If
though you write directly to the document then the document doesn't have a
URL on which to base the resolution of relative URLs.

You have a few options:

Inject all your CSS into a <styleelement in the HTML (ugly).

Make all paths in the HTML (src and hrefs) absolute paths (also ugly)

Add a <baseelement to the head of the HTML which specifies the path to a
folder which acts as a basis to resolve relative URLs.
--
Anthony Jones - MVP ASP/ASP.NET
Aug 10 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: John | last post by:
I have over 5000 thumbnail pictures of size 5kb each. I would like to able to load all 5000 pictures and view 50 per page using mysql_data_seek(). I would like to know what are the advantages and...
13
by: Ken | last post by:
How do I download files from the internet server to my computer? How do I tell the script the correct hard drive folder on my computer to copy the files to? After connecting to the internet...
4
by: Bob Bedford | last post by:
I've been able to parse the XML files used to update my database. Now, I receive image in XML files, like this: <PICTURES COUNT="3" CDATA="1"> <PIC NR="1"><!]></PIC> <PIC...
1
by: PeterFI | last post by:
Hello, my problem is as follows, I have a web page where user can upload pictures to unix server from his own computer. Pictures are uploaded fine, but the rights of those files are not...
1
by: Robert Wagstaff | last post by:
I have an interesting challenge. I have a client that is putting pictures into a single folder on the web server. The files are specific in that the first 5 characters of the filename are the...
8
by: Michael Mayer | last post by:
I have a windows forms app and am wondering how I find the My Document's folder of the current user. Is there a class or namespace in .NET to assist with this? Or must I use P/Invoke - if so,...
1
by: Bob Bedford | last post by:
Hi all, I need help for parsing a huge XML file with some ISP limits (I can't change ISP, so this isn't a solution). The ISP limits the scripts to 16MB and 10 seconds. Those params can't be...
46
by: OldBirdman | last post by:
What a mess this question is. I have spent 2 weeks trying to make it concise and clear, and I can't. I do not have the vocabulary for the question. I cannot even TITLE it correctly. Here is my...
0
by: Flofloski | last post by:
Hi Im making a game where it had 5 buttons with a picturebox behind each button that has visible = false. when the button is clicked it makes the visble = true. The problem im having is that i...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.