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

RE: appendig to multiple output files

Subject: RE: appendig to multiple output files
From: "Bryan Rasmussen" <bry@xxxxxxxxxx>
Date: Thu, 24 Jan 2002 15:45:20 +0100
href download text file

> out of this XML file I want to generate in a *single* transformation
> process two separate, completely different output files (method="text")

>    <xsl:document method="text" href="somefilename">
>     <xslvalue-of select="content"/>
>     ...
>   </xsl:document>

>    <xsl:apply-templates select="anotherelement"/>
> </xsel:template>

>  <xsl:template match="anotherelement">
>    <!-- more output *appended* to main document -->
>    <xsl-value-of select="..."/>

>  <xsl:docmument method="text" href="somefilename">
>      <xsl:value-of select="some content"/>
>      ...
>    </xsl_document>

> </xsl:template>

the problem, like I pointed out in one of my posts is you can't read in a
text file, unless there's some extension for it, probably with xalan. or you
write your own.
If you could read in a text file you could do the same as I did in my
example for xml:

if you had xml like this:

<?xml version='1.0' encoding="utf-16"?>
<output file="e_files.xml">

and an xslt like this
<?xml version='1.0' encoding="utf-16"?>

<xsl:stylesheet version='1.1'

<xsl:template match="/">

<xsl:template match="output">
<xsl:variable name="href"><xsl:value-of select="@file"/></xsl:variable>
<xsl:param name="input" select="document($href)"/>
<xsl:document href="{$href}" method="xml">
<xsl:copy-of select="$input"/>

<xsl:template match="p">
<para><xsl:value-of select="."/></para>


you could then keep reading in the xml again and again and overwriting
e_files.xml, copying the content it had, and appending the content in your
file with output.
but can't do this with a simple text, cause you can't use document() to get
a text file. with xslt 2.0 you can use unparsed-text(uri,encoding-string?)
to get text files, in that case you should be able to do the same thing, as
so my advice is use xml instead of text and you can set the above up easily
enough(few modifications required of course.)

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

Current Thread


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.
First Name
Last Name
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.