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

xsl:result-document appending

Subject: xsl:result-document appending
From: "Kloeck, Erwin" <Erwin.Kloeck@xxxxxx>
Date: Fri, 19 Sep 2003 10:12:55 +0200
xsl item value
Hi,

I want to write out something like a log file from within a for-each loop.
I do some processing and at one point within the loop I want to write a line
to a different file. 

Here is what I do:

--------- log.xml --------- 
<?xml version="1.0" encoding="UTF-8"?>
<top>
  <item value="hugo"/>
  <item value="otto"/>
  <item value="xaver"/>
</top>

--------- log.xsl --------- 
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
  
  <xsl:output name="log-format" method="text" omit-xml-declaration="yes"/>
  <xsl:template match="/">
    <xsl:for-each select="top/item">

	<!-- some involved processing with variables that are used in the log entry -->

      <xsl:result-document href="log.txt" format="log-format" >
        <xsl:value-of select="concat(string(position()), ' = ', @value)"/>
      </xsl:result-document >
    </xsl:for-each>
  </xsl:template>
</xsl:stylesheet>

--------- log.txt --------- 
3 = xaver


I would like log.txt to look like this:
--------- log.txt --------- 
1 = hugo
2 = otto
3 = xaver

For this I would like to be able to append to the existing log.txt file.
Is there a way to do this?


The alternative I can think of is to run trough the for-each loop twice, once to do the processing
and once to write the log file. I hope I have other options.


Thanks

Erwin

..............................

Erwin Kloeck
Produktentwicklung

Oestreicher + Wagner 
Medientechnik GmbH
Frankenthaler Strasse 20
D-81539 Muenchen

Fon   +49 (0)89-68961 216 
Fax   +49 (0)89-68961 271


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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-2013 All Rights Reserved.