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

RE: result-document overwrites previous result

Subject: RE: result-document overwrites previous result
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Wed, 2 Jun 2004 21:33:15 +0100
xsl result document
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  result-document overwrites previous result
> 
> Unlike the output file, the result-document file contains 
> only the last
> "Address" processed. My goal is to output addresses in a file 
> other than
> the "output file". Can I achieve this using result-document 
> or should I
> use a different approach?

xsl:result-document creates a complete document each time it is invoked.
It's supposed to be an error to write to the same URI more than once, but
Saxon isn't currently detecting this error (it simply overwrites the file).

xsl:result-document isn't designed to append - that would make the results
dependent on order of evaluation. If you want to create two output files,
you need to create one of them completely, then the other completely, you
can't interleave them. This means structuring your stylesheet differently.

It's possible that you could use (abuse!) Saxon's OutputURIResolver to
append to existing files, but it's not something I would recommend.

Michael Kay



> To top this, I would like to append to the file if "addressfilename"
> exists. Please help this newbie. Thanks.
> 
> I am using Saxon 7.9.1 and JDK 1.4.2
> The xslt file is-
> <?xml version="1.0"?>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> 	<xsl:param name="addressfilename"/>
> 
> 	<xsl:output method="text"/>
> 
> 	<xsl:template match="/">
> 		<xsl:apply-templates select="Organization/Member"/>
> 	</xsl:template>
> 
> 	<xsl:template match="Member">
> 		<xsl:value-of select="@FirstName"/>
> 		<xsl:text>|</xsl:text>
> 		<xsl:value-of select="@LastName"/>
> 		<xsl:text>
> </xsl:text>
> 
> 		<xsl:if test="$addressfilename">
> 			<xsl:result-document
> href="file:///{$addressfilename}">
> 				<xsl:value-of select="concat(@ZipCode,
> '|', @Street, '|', @City, '|', @State)"/>
> 		<xsl:text>
> </xsl:text>
> 			</xsl:result-document>
> 		</xsl:if>
> 	</xsl:template>
> 
> </xsl:stylesheet>
> 
> 
> --+------------------------------------------------------------------
> XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
> or e-mail: <mailto:xsl-list-unsubscribe@xxxxxxxxxxxxxxxxxxxxxx>
> --+--
> 
> 



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.