This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: appending output to file using saxon


Jakob Fix wrote: Is there a way to append content to an existing file using
Saxon?  Or any other
way?


hmm, not sure if I get the whole question here, but the above is clear
enough, I gave a solution that allowed one to append content to a file
several months ago, it can be found at:
http://www.biglist.com/lists/xsl-list/archives/200201/msg01251.html but note
the following posts to that and the controversy that ensued to see that,
although this in fact worked it was a bad thing.

here's the xslt again:
<?xml version='1.0' encoding="utf-16"?>

<xsl:stylesheet version='1.1'
    xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
>

<xsl:template match="/">
<xsl:apply-templates/>
</xsl:template>

<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">
<root>
<xsl:copy-of select="$input"/>
<xsl:apply-templates/></root>
</xsl:document>
</xsl:template>

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




</xsl:stylesheet>

Actually I'm glad that this came up because I wanted to take the subject up
again and was contemplating a post. Given that the above solution is
bad(side effects I take it being possible because $input which selects
document($href) is output inside an xsl:document which generates $href,
although I'd thought that as $input came before the xsl:document element it
should be read in and side-effects be impossible), is there a possible
solution whereby one can 'append' to a document in the way the one above
does?








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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]