|
In .NET 1.1, a lot of the methods on XslTransform are obsolete - meaning they will go away in a future version. You should not use them. Of course, if you intend to support .NET 1.0 you don't have a choice. Reading the documentation will help you determine what's obsolete, what's new, and how to use the classes instead of just using IntelliSense and guessing.
This is only a warning, though. If you're getting an error that either stops the code from compiling or that is getting thrown at runtime, then that's a different problem and you should post the exact exception that's being thrown.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
The exact exception is weird.
He says:
An unhandled exception of type 'System.Xml.XmlException' occurred in system.xml.dll<br />
Additional information: System error.
He always stops at the line after this code:
trans.Load(@"c:\XSL.xslt");
no mather what i write so the problem is something with that line but it looks allright to me.
If this doesn't work, maybe you know a different way to sort my xml?
Thx a lot
|
|
|
|
|
It's likely that either your XSLT document is not well-formed XML or that you haven't specified the XSLT namespace (http://www.w3.org/1999/XSL/Transform).
Also, this is definitely the easier way. The only other way would be to navigate the DOM and either sort the data yourself or use an XPath navigator and wrote-out the DOM again in a sorted manner. XSLT does this for you.
It does work, but you're doing something wrong. The two problems I mentioned above are most likely the problems.
If you open your XSLT document in Internet Explorer, it should tell you where the error is if the document is not well formed (this is pretty simple to do programmatically too, but using IE you don't have to write anything). If the XSLT namespace isn't included, then your document is technically NOT and XSLT.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
thanx! the namespace was the mistake, but it's an url so does the computer need an internetconnection for it to work?
I searched for this a looooong time, thanx a lot. But there are probably still some mistake in my xslt. He writes a new xml file which is good but he doesn't write the attributes so <library name="t"> becomes <library> and he doesn't sort the xml
so i'll still be busy for while
thx again
|
|
|
|
|
No, a namespace is just a logical qualifer. It could be "asdf" or something like "urn:schemas-microsoft-com:office:word". So long as the XML document and XSLT agree on a namespace (the prefix doesn't matter), then the elements and attributes (though attributes usually aren't namespace-qualified) refer to the same thing. If they don't have the same namespace, then even elements named the same thing are the same thing.
You should read about XML on http://www.w3.org[^], especially XML namespaces.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
YES it finally works, took me about 2 weeks
Nothing is better then making a program work
if your interested this is the XSLT file:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()">
<xsl:sort data-type="number" select="loadorder"/>
</xsl:apply-templates>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
Thx again for the help, it's great that you help so many people (i see your name at almost every question)
|
|
|
|
|
how i can write Ackermann Function not use recursion
Nothing
|
|
|
|
|
Excuse the dumb question:
Why would you want to? It's defined recursively, right? C# supports recursion...so what's the issue?
Bill
|
|
|
|
|
Unless you want to write out MILLIONS of line of code unrolling the function, you best use the recursion...
RageInTheMachine9532
|
|
|
|
|
I would like to call c++ function from managed code as a call back function. How can I implement this feature in csharp? In this case I need to call c++ function after receiving some message in managed code.
|
|
|
|
|
Depends on your implementation. If you just want to call the callback then P/Invoke the exported function and call it in your loop (or whatever). If you want to pass the function as a parameter into some managed method, still P/Invoke the method but create a delegate with a matching signature and pass the delegate - pointing to the P/Invoke'd method, since a delegate is just a managed function pointer - to the method. If a delegate Type is already defined, you'll need to use a sort of thunking method that the delegate "points" to that in turn unwraps or wraps the parameters and calls your P/Invoke'd method.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I'm having a big problem.
I have a button on my form to sort the datagrid with a dataview. When i click it he sorts the data. That works fine but when i click a row to delete it he uses the rowindex of the datagrid before the sort. So when i click delete then he deletes a row but not the right one. Because the rowindex is not correct.
thx in advance!
|
|
|
|
|
A DataView is used to sort data, even internally by the DataGrid . You must get this DataView and use the "row index" to refer to a row in the DataView , not your original DataTable .
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
but if sort my datagrid with a dataview and then i select a row in the datagrid, how can i know what the rowindex really is? so that he doesn't change or delete a wrong row?
do you understand what mean cause i'm having trouble explaining it in english
thx for your help
|
|
|
|
|
Yes, I understand what you're trying to do - and always have - but I believe it's you that's not understand the solution. If you use the row index in the DataView - it's the row index of the sorted view and that will return you the correct DataRow , which you can use to change information in its columns or remove from the table (by referring to the DataRow itself - forget about the index).
Besides, why do you even care anyway? In the DataGrid , if the user makes any changes the correct data is changed / inserted / deleted. All you need to do is get the DataSet or DataTable from the DataGrid.DataSource property and call DataSet.GetChanges to get a DataSet of just the changes (not required but it does decrease bandwidth consumption and boost performance in a distributed system).
A DataView is just the view on the data. It tracks the DataRow as it sorts and filters them.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hello everybody
I can get the system date using DateTime.Now()
But how can I set the system date?
Thanks in advance...
|
|
|
|
|
|
And, oddly enough, about every day for the last week it seems! I guess no one cares to search first, which is why they're probably left asking such simple questions.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Maybe we're seeing the bud of a good suggestion for the site, a knowledge base of commonly-asked questions for all categories. It wouldn't eliminate the problem entirely, but a little notice at the top of each forum would probably help, and the base itself would be valuable. We most likely have the biggest brain trust of any programming-related site on the web here. A few simple measures to increase the page ranking of the stuff in the base would probably drive more visitors to the site, too, and instead of getting first results of some half-readable question (sometimes) they'd always get a nice-looking little "articlet".
-Jeff
here, bloggy bloggy
|
|
|
|
|
Nick Parker and I are currently working on a C# FAQ, those his graduation and my activity at work are slowing things down a little. We've already got Chris to agree to post it on the C# forum posting page like there is/was for the C/C++ forum (a FAQ by Mike Dunn).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Great! Hopefully that'll stem the tide a little. It's important that something like that start off right, with a good content base. Have you thought about letting the community put in content, with the editors having the ability to weed out the bad, or maybe have a little approval process? That'd still give you the chance to edit the content for correctness and wording.
-Jeff
here, bloggy bloggy
|
|
|
|
|
CP doesn't really have the architecture for it - that would be more of a Wiki sort of thing. But we're definitely open to some input.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Well, in the meantime I'm sure that people can always send you an email request if they feel strongly about something. Architectural changes would just make it a little easier in the long run. Maybe you should consider setting up an email account just to receive requests, and post a link to it at the top of the page serving the content. Also, you could pretty easily just create an extra ASP page to take suggestions for the FAQ, which would send it to an email address that you guys could check on an infrequent basis.
Just the word "Wiki" is tantalizing.
-Jeff
here, bloggy bloggy
|
|
|
|
|
|
GOOD IDEA! FAQ I like it.
/\ |_ E X E GG
|
|
|
|