Anyone else used XSL transforms in .NET? It appears that fking thing (Tranform function of XslCompiledTransform) walks the whole XML document BEFORE actually running bloody template, instead of just running specific XPath statements found in XSL template, ffs, anyone who tried XSL in .NET please post here on your experience.
- Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
- Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!
XSL tranforms in .NET
Collapse
X
-
-
Originally posted by AtWAnyone else used XSL transforms in .NET? It appears that fking thing (Tranform function of XslCompiledTransform) walks the whole XML document BEFORE actually running bloody template, instead of just running specific XPath statements found in XSL template, ffs, anyone who tried XSL in .NET please post here on your experience.whats the lowest you can do this for? -
I've got running test here that made me certain it happens - I pass XPathNavigator object to it, if I run XPath directly on that object then it only touches bits that have to be touched, when I put same XPath into XSL document I can see that whole object is walked, in fact if I have empty (!) XSL template the fking thing still walks the whole object. How do I know? Because I've got XPathNavigator over normal live .NET object and can see that its being walked over.
To add insult to injury it appears that XSL POS adds some junk into output that should not be there - its junk and some searches on the Net seems to confirm that.Comment
-
This should be posted in the technical forums.
What are you using, an XmlDocument or XPathDocument or XmlDataDocument?
How are your XPath queries formulated? Do by their nature have to traverse the whole document to find the required node(s)?
Please read http://support.microsoft.com/kb/325689/EN-US/
PS V1.1 of the framework has a lot of issues processing XSLT on large XML documents. I believe V2.0 is much better in this respect.Comment
-
Originally posted by AtWI've got running test here that made me certain it happens - I pass XPathNavigator object to it, if I run XPath directly on that object then it only touches bits that have to be touched, when I put same XPath into XSL document I can see that whole object is walked, in fact if I have empty (!) XSL template the fking thing still walks the whole object. How do I know? Because I've got XPathNavigator over normal live .NET object and can see that its being walked over.
To add insult to injury it appears that XSL POS adds some junk into output that should not be there - its junk and some searches on the Net seems to confirm that.
Compiled XSLT explainedwhats the lowest you can do this for?Comment
-
I use FX 2.0.
I have got a custom object that implements XPathNavigator - this allows to run XPath queries and those work just fine, no problems there.
Then I thought to use XSL to run those XPath statements, here is how I do it:
Code:public string ExecXSLT(string sFileName,XsltArgumentList oList) { XslCompiledTransform oXsl=new XslCompiledTransform(); // loads XSL template oXsl.Load(sFileName); return ExecXSLT(oXsl,oList); } public string ExecXSLT(XslCompiledTransform oXsl,XsltArgumentList oList) { StringBuilder oSB=new StringBuilder(); XmlWriterSettings oWS=new XmlWriterSettings(); oWS.Indent=true; oWS.NewLineHandling=NewLineHandling.None; oWS.Encoding=Encoding.UTF8; oWS.OmitXmlDeclaration=false; oWS.ConformanceLevel=ConformanceLevel.Auto; XmlWriter oWriter=XmlWriter.Create(oSB,oWS); // Xnav is XPathNavigator object that controls actual data document that should be dealt with by XSL oXsl.Transform(Xnav,oList,oWriter); return oSB.ToString(); }
Comment
-
Oi!
Put this in technical Webby,FFS!
The general forum is reserved for mindless tosh, not this IT-related geek-speak.We must strike at the lies that have spread like disease through our mindsComment
-
As you can see from code above I use XPathNavigateable object, which should ensure tranformations are fast. XPath queries directly on that object work fast and nice. However giving it to Transform function of XSL is slow even when XSL document is empty - ie no queries there at all, none zero zilch. I can see from debugger that the damn thing walks whole tree of the XPathNavigeable object even though nobody asked it to do it - I can see it in debugger that they do it ffs. What's worse is that the damn thing adds to transformed results some junk that should not be there.Comment
-
Comment
-
Originally posted by DimPrawnI guess your code is just tulip then AtW.
If .NET hurts, you ain't doing it right.Comment
- Home
- News & Features
- First Timers
- IR35 / S660 / BN66
- Employee Benefit Trusts
- Agency Workers Regulations
- MSC Legislation
- Limited Companies
- Dividends
- Umbrella Company
- VAT / Flat Rate VAT
- Job News & Guides
- Money News & Guides
- Guide to Contracts
- Successful Contracting
- Contracting Overseas
- Contractor Calculators
- MVL
- Contractor Expenses
Advertisers
Contractor Services
CUK News
- Which IT contractor skills will be top five in 2025? Today 09:08
- Secondary NI threshold sinking to £5,000: a limited company director’s explainer Dec 24 09:51
- Reeves sets Spring Statement 2025 for March 26th Dec 23 09:18
- Spot the hidden contractor Dec 20 10:43
- Accounting for Contractors Dec 19 15:30
- Chartered Accountants with MarchMutual Dec 19 15:05
- Chartered Accountants with March Mutual Dec 19 15:05
- Chartered Accountants Dec 19 15:05
- Unfairly barred from contracting? Petrofac just paid the price Dec 19 09:43
- An IR35 case law look back: contractor must-knows for 2025-26 Dec 18 09:30
Comment