[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Filtering new tags

Subject: Re: Filtering new tags
From: "Joe Fawcett" <joefawcett@xxxxxxxxxxx>
Date: Fri, 25 Jan 2008 10:47:29 -0000
Re:  Filtering new tags
--------------------------------------------------
From: "buddhi" <buddhi@xxxxxxxxxxxxxxxxxxx>
Sent: Friday, January 25, 2008 10:09 AM
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Subject: Re:  Filtering new tags

Yea that is exactly what I need but it is not working for me...

This is the way that I have used it...

XslTransform myXslTransform;
XPathDocument myXPathDocument = new XPathDocument ("C:\New.xml");
myXslTransform = new XslTransform();
myXslTransform.Load( sApplicationPath + @"\style.xsl" ); XmlTextWriter writer = new XmlTextWriter(sApplicationPath + @"\NewTags.xml", System.Text.Encoding.UTF8); writer.Formatting = Formatting.Indented;
myXslTransform.Transform(myXPathDocument,null, writer, null);
writer.Flush();
writer.Close();


Above is using C# with msxml

- Buddhi -

Mukul Gandhi wrote:
I am getting similar result with MSXML 4.0 as well.

Following is the example I tried:

old.xml
----------
<root>
  <data name="XY">
    <value>XY Editor</value>
    <comment>XY</comment>
  </data>
</root>

new.xml
------------
<root>
  <data name="DE">
     <value>Drawing Editor</value>
     <comment>DE</comment>
  </data>
  <data name="XY">
     <value>XY Editor</value>
     <comment>XY</comment>
  </data>
  <data name="PQ">
     <value>PQ Editor</value>
     <comment>PQ</comment>
   </data>
 </root>

The stylesheet is what you posted. Except, I added this line:
<xsl:output method="xml" encoding="UTF-8" /> (just to improve
serialization on the command prompt).

msxsl invocation produces following output:

C:\xml>msxsl new.xml test.xsl
<?xml version="1.0" encoding="UTF-8"?>
<newtags>
  <data name="DE">
    <value>Drawing Editor</value>
    <comment>DE</comment>
  </data>
  <data name="PQ">
    <value>PQ Editor</value>
    <comment>PQ</comment>
 </data></newtags>

Same output is produced with Xalan-J 2.7.1.

Is this what you are looking for? Or, we haven't understood your requirement ...

On 1/25/08, buddhi <buddhi@xxxxxxxxxxxxxxxxxxx> wrote:

hi Gandi and all,

yes you are absolutely correct but I am not getting only newly added
text, I am getting old tags + newly added tags. I am using MS XSLT

- Buddhi -


That's using .NET's System.Xml, not MSXML.
I ran the suggested code within Visual Studio and it worked as expected.
However I changed:
 XPathDocument myXPathDocument = new XPathDocument ("C:\New.xml");

to:
XPathDocument myXPathDocument = new XPathDocument ("@C:\New.xml");
and obviously populated sApplicationPath.
My code:
string sApplicationPath = @"<path to my project here>";
XslTransform myXslTransform;
XPathDocument myXPathDocument = new XPathDocument (sApplicationPath + @"\New.xml");
myXslTransform = new XslTransform();
myXslTransform.Load(sApplicationPath + @"\style.xslt");
XmlTextWriter writer = new XmlTextWriter(sApplicationPath + @"\NewTags.xml", System.Text.Encoding.UTF8);
writer.Formatting = Formatting.Indented;
myXslTransform.Transform(myXPathDocument, null, writer, null);
writer.Flush();
writer.Close();


Joe
http://joe.fawcett.name


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2011 All Rights Reserved.