W3C home > Mailing lists > Public > public-qt-comments@w3.org > October 2002

RE: How to perform output in two destinations

From: Kay, Michael <Michael.Kay@softwareag.com>
Date: Tue, 22 Oct 2002 12:55:27 +0200
Message-ID: <DFF2AC9E3583D511A21F0008C7E621060453DCBD@daemsg02.software-ag.de>
To: Vladimir Nesterovsky <vladimir@nesterovsky-bros.com>, public-qt-comments@w3.org

> -----Original Message-----
> From: Vladimir Nesterovsky [mailto:vladimir@nesterovsky-bros.com] 
> How can I effectively process data with result that consist 
> of two outputs (first is a main result, and second is a log).
> In order to achieve required results I have to perform either:
>   a) two time processing: first in order to get main result 
> and another to get log; or
>   b) create temporary tree with both main result and log, and 
> then create two result xml(s) by filtering data in that 
> temporary tree.

I think the problem of producing two separate result documents is exactly
the same as producing a single document that contains the "main result" and
the "log" as separate sub-elements. We don't allow "interleaved" writing in
either case, and I don't think the two cases are essentially different. In
both cases the stylesheet must be written to produce one output first, then
the other.

I recognize there are use cases where this can cause difficulty. Your
particular use case, of producing a log, is covered I think by
<xsl:message>. Whether xsl:message meets the requirement depends rather on
the implementation. I know that some implementors provide very little
control over the destination of messages, and some discard the message
entirely, but this is a matter for implementors, not for the specification

Any attempt to offer interleaved writing - including the xsl:message
capability - suffers from the fact that the sequence of nodes in the result
tree will depend on the order of execution of instructions in the
stylesheet. For example, if xsl:message is included inside xsl:variable,
then the number of messages output and their relative order depends on the
order in which variables are evaluated, and on whether their values are held
in memory or re-evaluated on demand.

Michael Kay

> >From my user's perspective it would be useful to have a 
> stack of active
> named (or indexed) output trees and ability to dynamically 
> switch between them. The following example demonstrates such 
> a hypothetical
> feature:
>  <xsl:variable name="log" tree-name="log">
>   <xsl:variable name="result" tree-name="result">
>       Generate here main result
>       <xsl:output-tree name="log">
>         Put here log data
>       </xsl:output-tree>
>       Generate here main result again
>    </xsl:variable>
>   <!--
>     Here we have result in $result and log in the $log
>   -->
>  </xsl:variable>
> or
> <xsl:principal-result-document tree-name="result"/>
> <template name="my-template">
>   <xsl:result-document tree-name="log">
>       <xsl:output-tree name="result">
>         Generate here main result
>         <xsl:output-tree name="log">
>           Put here log data
>         </xsl:output-tree>
>         Generate here main result again
>       </xsl:output-tree>
>   </xsl:result-document>
> </template>
> <!--
>   here we have result in the principal-result-document and
>   log in the secondary result-document.
> -->
> In these examples tree-name attribute defines a name of tree 
> (temporary tree or result tree) and xsl:output-tree element 
> defines what destination to use for output.
> --
> Nesterovsky Vladimir
> vladimir@nesterovsky-bros.com
Received on Tuesday, 22 October 2002 06:55:35 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 16:56:43 UTC