Lightweight "XSLTransform"?



  • 1. Comparing two xmls based on keys....
    Hi, I need to compare two xml files. Which contain multiple xml datas based on a key. So for eg. I have two xmls A.xml and B.xml. A.xml : <?xml version="1.0" encoding="UTF-8"?> <Test > <Item>1</Item> <Name>Orange</Name> </Test> <Test > <Item>2</Item> <Name>Apple</Name> </Test> Whereas B.xml : <?xml version="1.0" encoding="UTF-8"?> <Test > <Item>2/Item> <Name>Apple</Name> </Test> <Test > <Item>1</Item> <Name>Orange</Name> </Test> If you compare tags row by row then the xmls won't match but if you keep the Item as the key then both the xmls are equal. Item : 1 / Name : Orange Item : 2 / Name : Apple How can you do such comparison in Java Cheers Nick
  • 2. Double encoding?
    I am generating an XML in my SP in SQL 2005. One of the columns in the table is called Title and has a value Engne ir However, in the final XML I get the above as: Engne ir— (the & got replaced by &) Is there a way to prevent this double encoding?
  • 3. why selectNodes returns nothing?
    my xml file is like this: <?xml version="1.0" encoding="gb2312"?> <VisualStudioPropertySheet ProjectType="Visual C++" ...> <UserMacro Name="test" Value="test"/> </VisualStudioPropertySheet> xmlmodel.selectNodes("//UserMacro"); xmlmodel.selectSingleNode("//UserMacro[@Name=test]"); both return nothing, why?

Lightweight "XSLTransform"?

Postby bill salkin » Wed, 03 Dec 2003 16:47:57 GMT

I have an XML input document with > 10,000 elements (and 
larger documents may be coming in the future.). I need to 
apply an XSLT Transform to it but all the methods I know 
of use an XPathNavigator, which relies on XmlDocument, 
which reads the entire XML document into memory! Not good.

Is there a lightweight XSLT approach that reads in, and 
processes, say just an element at a time? (Like the
"XmlTextReader" object fo reading XML files)?



Re: Lightweight "XSLTransform"?

Postby Martin Honnen » Wed, 03 Dec 2003 20:00:22 GMT

You can read in the style sheet with a reader class. And you don't need 
to use a full fledged XmlDocument, a System.Xml.XPath.XPathDocument 
should do which is optimized for XSLT/XPath processing.
I haven't made any tests but from the docs I understand that to be less 
memory intensive than using an XmlDocument.

	Martin Honnen

Re: Lightweight "XSLTransform"?

Postby Oleg Tkachenko » Wed, 03 Dec 2003 22:42:33 GMT

XPathDocument doesn't rely on XmlDocument at all. That's completely 
different data model, much lightweight than DOM. But it also loads the 
whole document into memory, but in more effective way.

Nope. XSLT and XPath are defined to operate on the whole tree. If your 
transformation logic is so simple you can implement it only using 
XmlReader and XmlWriter.
Oleg Tkachenko
XML Insider

Similar Threads:

1.Javascript problems from a lightweight - xmlhttprequest and html fragments

I am redoing my website and trying to get it to do something more
exciting using Javascript. I did normal Java at university and code at
work in VB.NET. I have got reasonably far into what I want to do but am
having some issues.

I am using an XmlHttpRequest to pull html fragments out of files and
wish to put them into the main doccument inplace of a <span></span>
which has a given id. The user enters a "command" into a TextField and
when the onchange event is thrown I am using the contents of the text
field in a switch statement to decide which fragment should be loaded.
This works ok when TAB is pressed to throw the onchange event, apart
from the text field losing focus (which I don't want). However when
return or enter are pressed  the fragment is loaded and placed in the
correct place, then the page seems to reload or refresh and loses it
again. To make this work will I need to store the loaded data so it
gets displayed again on the <body onload> event? I need someway of
getting around this refresh issue.

Secondly I get a strange duplication of information when the fragment
is loaded. The top part (main fragment that is loaded with the <body
onload> event. It does not get duplicated as text, but as some strange
unselectable object.

Ill try and get some dribbles of code up soon but I am not writing this
from my development machine.

Any help would be greatly appretiated.

Oh and can some one tell me, what is the life of a javascript variable?
Does it survive past refresh? When the script is loaded is that version
of it always used for the viewing session or does each refresh destroy
everything? If it does destroy everyting what is the best place to
store stuff - will I have to use a cookie?

Phil. 1.5 - a lightweight HTML/XML generator

3.[ANN] 1.5 - a lightweight HTML/XML generator

4.Looking for Lightweight XML Parser/Builder


I'm looking for a package that I can install on both a Linux and a
Windows (Arrrgh) platform to support a small application I building in

It needs to be a single download on either platform that supports
building XML and parsing XML.  Nothing fancy.

Suggestions ??


5.Problem for C# intellectuals: need a unique hash out of an XslTransform object

Here is the issue.  I need to uniquely identify an XslTransform objects
without knowing how they are constructed.

Solution 1: Get the underlying source XSL and run a hash that

Issues: No "Source()" or "OuterXml()" or similar method exists

Solution 2: Use some sort of persitance method to get a stream and hash

Issues: Again no such method exists on that class.

Solution 3: Get a pointer to the object in memory, and use the binary
foot print as a basis for the hash.

Issues: "Unsafe code" (not that I am scared of that), and the fact that
I can't seem to get pointers to work for objects (which confirms what
little ms has written on the subject).

Solution 4: Wrap the XslTransform with my own class, implementing a
"LoadXsl(string xsl)" method.

Issues: well, at least I can implement this for sure, but would rather
not have to do it.

Any comments on any of these solutions, or any ideas will be greatly



6. Migrating an Xml control using XslTransform

7. XslTransform

8. Very Slow XSLTransform with XPathDocument

Return to xml


Who is online

Users browsing this forum: No registered users and 74 guest