[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: What is Micro Pipelining: an attempt for a definit
Hi Wendell,
Very valuable feedback. However, though I think I grasp your points, after reading I still find a lot of "micro-pipelining" to be in a gray area. Let me try to explain myself. For me, micro-pipelining is defined as the process of pipelining a set of data during a one pass through an XSLT processor. Normal pipelining would be to re-apply the results of one pass to the next pass. I understand that this doesn't tally with your definition below. Another attempt for a definition (still my own, original, definition) would be the following: in a case where you apply templates (or for-each perhaps) to a set of data that is not part of the input data (input data being any external source, including document() / collection() etc) is a micro pipeline. Shorter: when you have a variable to contain data that is already processed and you re-apply this variable, it is a micro pipeline. Now I do understand that this is a bit of a too wide definition. But now on to yours. You explain that for anything to be a micro pipeline it must be applied (or expected to be applied) more than once. More appropriately: when you can extract the pipeline variable into a global variable, it is not a micro pipeline anymore (is it then a macro pipeline?). But things are still not so trivial. It is tempting to say that the following is only executed once, because there's only one root in a document, and as a result, it is easy to extract the variable to the global level: <xsl:template match="/"> <xsl:variable name="micro"> <xsl:apply-templates select="root/some/data" /> </xsl:variable> <xsl:apply-templates select="$micro/*" /> </xsl:template> But often, simple examples, or inquiries on this list, are part of a larger stylesheet or solution. Suppose I alter the above example to be as follows: <xsl:param name="urls" select=" 'one.xml', 'two.xml', 'three.xml' " /> <xsl:template name="main"> <xsl:apply-templates select="document($list-of-documents)" /> </xsl:template> <xsl:template match="/"> <xsl:variable name="micro"> <xsl:apply-templates select="root/some/data" /> </xsl:variable> <xsl:apply-templates select="$micro/*" /> </xsl:template> is it now still not a micro pipeline? It is applied several times (three times) and it is not possible anymore to make the variable global. Is it really necessary to restrict a micro pipeline to be one only when it is applied to a local level? Though I can follow your point in that it is closer to a "large pipeline" than to a "micro pipeline". Now let's try the other opposite. To define a term, you need to know where its boundaries are. Suppose we have the following fictional stylesheet, would the application of $micro be a micro pipeline? <xsl:variable name="micro"> this must be tokenized <xsl:variable> <xsl:template name="main"> <xsl:apply-templates select="my:tokenize($micro)" /> </xsl:template> <xsl:template match="my:token"> <xsl:copy-of select="." /> </xsl:template> <xsl:function name="my:tokenize"> <xsl:param name="tokens"> <xsl:variable name="preproc-tokens"> <xsl:for-each select="tokenize($tokens, ' ')"> <my:token value="{.}" /> </xsl:for-each> </xsl:variable> <xsl:apply-templates select="$preproc-tokens/*" mode="my:tokenize" /> </xsl:function> <xsl:template match="my:token" mode="my:tokenize"> <xsl:copy> <xsl:sequence select="replace('text(), [^A-z]', '')" /> </xsl:copy> </xsl:template> In this tokenize example we see two things. We see a global variable holding data. This is processed using my:tokenize() and then the results are re-applied. Even though we are talking about global data (holding a document node with text), I would consider both phases a micro pipeline: the apply-templates in the my:tokenize function starts a micro pipeline, and the apply-templates in the main entry template starts a micro pipeline. Or not? I don't know the answers. I have seen the term micro pipeline come up every now and then without a lot of explanation. I did a quick check on the internet a couple of times, but a clear definition seems hard to find. Even the XML Pipeline languages (still in Draft) at W3C do not mention the distinction. Wikipedia has a small but effective line on the subject though: "Some standards also categorize transformation as macro (changes impacting an entire file) or micro (impacting only an element or attribute)" (http://en.wikipedia.org/wiki/XML_pipeline). But this simple-enough definition does not help XSLT: we have root nodes, document nodes, files, non-xml data, result tree fragments, sequences.... When is it micro and when is it macro? I do think your definition comes quite close, but it has some rough edges. Would you (and others) give it a try? (the definition, I mean)? Cheers, -- Abel Braaksma Wendell Piez wrote: Abel,
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|