Sign In/My Account | View Cart  
advertisement

Article:
 Push, Pull, Next!
Subject: Design Choice
Date: 2005-09-30 14:50:04
From: JackParker

I went through all the proposed push/bull/hybrid variantions and it seems that one needs to choose a method based on the degree of control required. With pull you specify the output exactly. On the other hand, if you want the source XML to "drive" the output you can use the push method. If you need "complete control" use pull. This seems to match the declarative/imperative analogy.


The reason is that with the proper pull method using only <xsl:apply-templates/> you have leave the order of output elements completely up to the source XML doc. If the source XML doc has a <para> element before the <title> then the output is:

First paragraph


<h1>Beneath the underdog</h1>

Next paragraph



Previous Message Previous Message   Next Message Next Message


Titles Only Full Threads Newest First
  • Design Choice
    2005-09-30 17:34:51 Bob DuCharme [Reply]

    Greater control if you're more comfortable with imperative languages. After that your analogy breaks down. I get all the control I need with a push approach. If the source document may have a title element before a para and I really want the title before any paras in the result, I just have to put this:


    <xsl:apply-templates select="title"/>
    <xsl:apply-templates selet="para"/>


    Some people feel that they have more control with declarative languages. LISP geeks have been insisting on this for decades.


    Bob





Sponsored By: