Re: [xsl] Connecting the Source and Destination fields

Subject: Re: [xsl] Connecting the Source and Destination fields
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Wed, 29 Aug 2007 12:31:17 -0400
At 09:11 AM 8/29/2007, you wrote:
This seems to be a use-case for the in another thread mentioned so-called
"micro-pipelining". First process the input data to make them fit your
needs, then do whatever you want with the cleaned up data.

Actually, "micro-pipelining" is what we call it when you pre-process only a chunk of your input in an ad-hoc fashion, in the course of transforming the whole of it.


If you process a document and then process it again, even if most of the first pass is an identity transformation, that's just pipelining.

The difference can be seen by comparing two instances:

Pipelining:

<xsl:variable name="temp">
  <xsl:apply-templates mode="first"/>
</xsl:variable>

<xsl:template match="/">
  <xsl:apply-templates select="$temp" mode="second"/>
</xsl:template>

Micro-pipelining:

<xsl:template match="div">
  <xsl:variable name="temp">
    <xsl:apply-templates mode="temp"/>
  </xsl:variable>
  <xsl:apply-templates select="$temp"/>
</xsl:template>

In the pipelining example, the entire document is processed in "first" mode, and the result is processed again in "second" mode (by the template matching the document element). In the micro-pipelining example, only the children (and perhaps descendants) of the div are processed in "temp" mode, and then the results are processed.

So in the micro-pipelining example, the pipeline is scoped to the div.

This can be useful even at very low levels of the document, and can spare you having to run an entire pipeline when most of the document doesn't require it.

Cheers,
Wendell



======================================================================
Wendell Piez                            mailto:wapiez@xxxxxxxxxxxxxxxx
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                    Direct Phone: 301/315-9635
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
----------------------------------------------------------------------
  Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================

Current Thread