473,804 Members | 3,708 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Writing output to a 'log' file from within xsl:result-document

Greetings one and all,

I have a single source XML file and I am parsing the "records" within
it into separate XML files using xsl:result-document. All that works
fine. I am using the Saxon engine and I am supplying the .Transform()
with a Target File path which it is using to create an empty file (as
it is currently unused). So I end up with, say, 50 new XML flies and 1
empty XML file at the path of the Target File

<stylesheet>
<!-- context of Target File -->
<for-each loop>
<xsl:result-document href="file(n)">
<!-- context of New File (n) -->
<!-- Write output to New File ... -->
</xsl:result-document>
</for-each loop>
</stylesheet>

What I want to be able to do is write to the Target File context from
within the <xsl:result-documentcontext .

<stylesheet>
<!-- context of Target File -->
<for-each loop>
<xsl:result-document href="file(n)">
<!-- context of New File (n) -->
<!-- Write output to New File ... -->
<!-- Write message to Target File ... -->
</xsl:result-document>
</for-each loop>
</stylesheet>

The XSL file I am using (as an example) is below. Does anyone have any
suggestions or is this simply impossible. I have thought about using
<xsl:messagea nd capturing the output but I want this to be fully
self contained in the XSLT if it can be.

<xsl:styleshe et xmlns:xsl="http ://www.w3.org/1999/XSL/Transform"
version="2.0">
<xsl:param name="outputPat h" />
<xsl:variable name="dataMappi ng"
select="documen t('DataMapping. xml')" />
<xsl:key name="oceans" match="mapsecti on[@name='oceans']/
entry" use="@clientnam e" />
<xsl:template match="/">
<xsl:for-each select="main/datarecord">
<xsl:result-document href="file:///{$outputPath}-
{count(ancestor ::node()|preced ing::*)}.xml" >
<updateRecord >
<family><xsl:va lue-of select="species " /></family>
<genus><xsl:val ue-of select="subspec ies" /></genus>
<habitat>
<xsl:variable name="clientHab itat" select="locatio n" />
<xsl:for-each select="$dataMa pping">
<xsl:value-of select="key('oc eans', $clientHabitat)/
@internalname"/>
</xsl:for-each>
</habitat>
<fullname><xsl: value-of select="name" /></fullname>
</updateRecord>
</xsl:result-document>
</xsl:for-each>
</xsl:stylesheet>

Any help or advice greatly appreciated

Al

Jun 22 '07 #1
0 2396

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
3474
by: georgios zakitraxis | last post by:
Hello, I want to have a php script which pings a host with ping 1.1.1.1 -t all the time and it shoukld write these things to a logfile. When it comes like "timout exceeded" it should write this only once to a file. Because if timout is 2000 times I don't want to have timeout exceeded 200 times in a database. But when ping times are coming they should be logged in a file with date and time when the ping accured.
2
2169
by: Adam Carolla | last post by:
I have now spent well over 12 hours on this one problem. I am pulling data out of a database, the data in the database is categorized by a value (season). I need to title the first value, then echo the listings that would fall into that category. Once this is completed I need to then label the next value and echo the values that would fall into that category... so on and so forth.. this is concept I have had so far: ...
0
1190
by: reneecccwest | last post by:
Hello, I have three tables and would like to see the output result as below: --------------------- OUTPUT RESULT -------------------------------------- index_id officeid officename officecode officedescript Description attrcatitemid departmentID divisionID branchID sectionID unitID 6 9 00012 02 NNN Department 133 6 6 6 6 6
0
1041
by: reneecccwest | last post by:
Hello, I have three tables and would like to see the output result as below: --------------------- OUTPUT RESULT -------------------------------------- index_id officeid officename officecode officedescript Description attrcatitemid departmentID divisionID branchID sectionID unitID 6 9 00012 02 NNN Department 133 6 6 6 6 6
31
3689
by: JS | last post by:
We have the same floating point intensive C++ program that runs on Windows on Intel chip and on Sun Solaris on SPARC chips. The program reads the exactly the same input files on the two platforms. However, they generate slightly different results for floating point numbers. Are they really supposed to generate exactly the same results? I guess so because both platforms are supposed to be IEEE floating point standard (754?) compliant. ...
7
2829
by: David | last post by:
Hi, I have an asp page with a form. A user enters a serial number in a text box. I want to add a button next to the text box such as 'Check Serial' to run some SQL in the background to see if that serial exists in the table, and then output 'Serial found' or 'Serial Not Found' next to the text box, so the user can decide whether to continue with the form.
1
6227
by: mamin | last post by:
Hi, I need to output result of my query to txt file. So I'm using -o parameter, for example: osql.exe -s (local) -d database1 -U sa -P sa -i 'c:\\queryFile.sql' -o 'c:\\output.txt' But it clears existing output.txt file first and then outputs the result, while I need to append the result of my query without clearing existing file content. Is it possible ?
6
4728
by: questionit | last post by:
How to output anything on Dos Prompt using VBA? And how to read line in Dos Prompt? Thanks
6
11940
by: Lasse Edsvik | last post by:
Hello I have a slight problem, I'm trying to open a textfile that has been saved as UTF-8. But when I run it it displays strange chars eventhough i've specified that it should read the file as UTF-8 using the OpenTextFile method of the filesystemobject. I need to open the file, then insert data to a database, nothing will get printed out on screen so its not a html-charset problem. How do I fix this?
2
2521
by: ccarter45 | last post by:
Help! I need to write a program that reads a text file with numbers and sums up each line of numbers. Then write a part of the program that outputs the text to another file. How do I do this? Here's what the data file looks like: 1 2 2 3 3 4 4 5 5 6 Here is the code I have: import java.util.Scanner;
0
9706
marktang
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...
0
10335
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9157
agi2029
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...
1
7621
isladogs
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...
0
6854
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();...
0
5525
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5652
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4301
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3821
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.