473,397 Members | 2,116 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

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:messageand capturing the output but I want this to be fully
self contained in the XSLT if it can be.

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="2.0">
<xsl:param name="outputPath" />
<xsl:variable name="dataMapping"
select="document('DataMapping.xml')" />
<xsl:key name="oceans" match="mapsection[@name='oceans']/
entry" use="@clientname" />
<xsl:template match="/">
<xsl:for-each select="main/datarecord">
<xsl:result-document href="file:///{$outputPath}-
{count(ancestor::node()|preceding::*)}.xml" >
<updateRecord>
<family><xsl:value-of select="species" /></family>
<genus><xsl:value-of select="subspecies" /></genus>
<habitat>
<xsl:variable name="clientHabitat" select="location" />
<xsl:for-each select="$dataMapping">
<xsl:value-of select="key('oceans', $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 2372

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

Similar topics

1
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...
2
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...
0
by: reneecccwest | last post by:
Hello, I have three tables and would like to see the output result as below: --------------------- OUTPUT RESULT -------------------------------------- index_id ...
0
by: reneecccwest | last post by:
Hello, I have three tables and would like to see the output result as below: --------------------- OUTPUT RESULT -------------------------------------- index_id ...
31
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....
7
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...
1
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...
6
by: questionit | last post by:
How to output anything on Dos Prompt using VBA? And how to read line in Dos Prompt? Thanks
6
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...
2
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? ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
tracyyun
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...
0
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,...

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.