Hi guys!
I want to do a sequence of transformations on an xml file. here is the scenario:
Input.xml-------XSLT------>output.xml------XSLT------->output.xml.... ...
for fulfiling this i have to save the first output on my hard disk and then use it again.
What I have done is to copy the out put in to a temp.xml file , delete the out put file and use the temp.xml file as the input for the second transformation.
But it fails and the output isn't what I expected.
Do u have any ideas ?
Thank u in advanced.
5 1469 jkmyoung 2,057
Recognized Expert Top Contributor
Why are you deleting the output file? Why not use that as input to the 2nd transformation?
It's hard to tell what's wrong just from this description. Could you post the code you're using to do the transforms?
Yes I'll copy the code.
XslCompiledTran sform xslt = new XslCompiledTran sform();
xslt.Load(xsltI nput);// there are 2 .xsl files
if (!File.Exists(@ "c:\temp.xm l"))
{
xslt.Transform( @"c:\student.xm l",@"c:\output. xml")
File.Copy(@"c:\ output.xml", @"c:\temp.xml") ;
File.Delete(@"c :\output.xml");
}
else
{
xslt.Transform( @"c:\temp.xm l", @"c:\output.xml ");
File.Delete(@"c :\temp.xml");
File.Copy(@"c:\ output.xml", @"c:\temp.xml") ;
File.Delete(@"c :\output.xml");
}
}
}
I have to delete output file because it will be created at the next step again.
jkmyoung 2,057
Recognized Expert Top Contributor
Let me get this straight. 1st run through: temp.xml does not exist, we go into the first section.
2nd run through: temp.xml exists from the previous transformation, we go into the 2nd section.
You call this function twice, with different values for xsltInput.
Instead of in the first section - xslt.Transform(@"c:\student.xml",@"c:\output.xml")
-
File.Copy(@"c:\output.xml", @"c:\temp.xml");
-
File.Delete(@"c:\output.xml");
Why not just: - xslt.Transform(@"c:\student.xml",@"c:\temp.xml")
We already know the file doesn't exist.
---
2nd run through. Why are we copying the result back to temp.xml? Don't we want it in C:\output.xml now?
Let me get this straight. 1st run through: temp.xml does not exist, we go into the first section.
2nd run through: temp.xml exists from the previous transformation, we go into the 2nd section.
You call this function twice, with different values for xsltInput.
Instead of in the first section - xslt.Transform(@"c:\student.xml",@"c:\output.xml")
-
File.Copy(@"c:\output.xml", @"c:\temp.xml");
-
File.Delete(@"c:\output.xml");
Why not just: - xslt.Transform(@"c:\student.xml",@"c:\temp.xml")
We already know the file doesn't exist.
---
2nd run through. Why are we copying the result back to temp.xml? Don't we want it in C:\output.xml now?
In the first case I agree with you, but in 2nd, If I want to do more transformations , I need to use the temp as new input and I need output.xml for the result of this transformation. ..therefore I have to delete output again.
jkmyoung 2,057
Recognized Expert Top Contributor
In the first case I agree with you, but in 2nd, If I want to do more transformations , I need to use the temp as new input and I need output.xml for the result of this transformation. ..therefore I have to delete output again.
Where does the output go though?
If you want to do more transformations , you'll have to delete temp.xml; otherwise you'll start off from the 2nd step with the wrong xml/xsl combination.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Pete |
last post by:
I am just getting to grips with XML and I was wondering if you could help me
with something that no-one seems able or willing to help with..
I have an XSLT file which should be transforming a straight XML file
http://www.discovertravelandtours.com/test/templates/test.xml?Location=Germany
To another XML file
http://www.discovertravelandtours.com/test/templates/test2.xml?Location=Germany
|
by: full_philNO |
last post by:
Hi all,
I have a problem with the img tag. It simply doesn't want to translate
into a img XHTML tag.
When I write in XSLT :
<img src="..." alt="..." ..../> or <img src=".." alt="..."
.....></img>
The output is always :
|
by: RC |
last post by:
First, let me say I couldn't find a group discuss
XML/XSLT. So I only choose the closest groups to
post this message.
Here is part of my *.xsl file
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xalan="http://xml.apache.org/xalan"
xmlns:my-javascript-ext="my-ext1"
extension-element-prefixes="my-javascript-ext"
|
by: Stephen |
last post by:
I have the following that outputs an xml file to a div using ajax:
<script type="text/javascript">
function ajaxXML(url,control_id){
if (document.getElementById) {
var x = (window.ActiveXObject) ? new
ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
}
if (x) {
|
by: Teksure |
last post by:
Hi group, searching in the Internet I found two products for XML which
incorporate a very robust debugger for XSL/XSLT, I would like you to see
these products and then, give me your opinion about the development
environment or recommend me some other that you know.
XML IDE's
- http://xslt-process.sourceforge.net
- http://www.mentattech.com/themes/mentat/alchemist/index.html
Regards,
| |
by: Dan |
last post by:
I have a C# program which executes some XSLT transformations. The XSLT code
requires an input intermediate file, generated by other transformations, as
its duty is copying some data from an input XML while inserting into it
another XML fragment. E.g. let's say this is the original XML:
<Dummy>
<contacts>
... contacts go here ...
</contacts>
</Dummy>
|
by: Christopher |
last post by:
I am currently in the process of evaluating the performance hits of moving
to the .NET platform for our application. I created a sample project that
loads the transforms the same XML and XSLT in COM, COM using interop and in
C# and then transforms it to HTML. I also tried concatenating the XML and
XSL as a string and then loading it to the DOM once as opposed to loading
the DOM with the appendChild() method. I see that the C# version is...
|
by: daniele74 |
last post by:
Hy,
I want ask you this question.
I have two schema file schema1.xsd and schema2.xsd. then I have a
stylesheet transformation style2.xsl that show in a browser an xml file
that has schema2.xml as schema. moreover I have an xslt tranformation
that map schema1.xsd in schema2.xsd (schema1TOschema2.xslt).
so the question is: it is possible to use style2.xsl to view xml file
that has schema1 as schema??
with instractions similar to this...
|
by: killy971 |
last post by:
I have been testing different libraries to process XSL transformations
on large XML files.
The fact is that I read a document from Intel, stating their library
(XSLT accelerator) was more twice faster than Apache Xalan, and was
designed to perform well on large XML files.
- http://isdlibrary.intel-dispatch.com/isd/10/wp_XSLT.PDF
- http://www.intel.com/cd/software/products/asmo-na/eng/366637.htm
Please note that their benchmark was only...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |