xsl-list
[Top] [All Lists]

Re: [xsl] XSLT Dead?

2007-04-17 16:11:34

Well the answer I look for is that with xsl:apply-templates the
processing is controlled by the structure of the input document, while
with xsl:for-each the processing is controlled by the stylesheet.

I think I'd fail the test:-)

if I'm in an xhtml document and processing a p(aragraph) and do
<xsl:template match="h:p">
  <xsl:apply-templates select="/h:html/h:head/h:title"/>
  <xsl:for-each select="node()">
    <a id="generate-id()"/><xsl:copy-of select="."/>
  </xsl:for-each>
</xsl:template>

Then I'd say that the first part is "pull" style where you have gone
off and fetched data from elsewhere in the document, but it's coded with
apply-templates, and the second part is "push" style where you are
walking the children in document order, letting the input drive the
result.

so I think that the "pulliness" or "pushiness" of a stylesheet depends
mostly on the nature of the xpaths used in select
attributes. apply-templates select defaults to node() which is the
canonical "push" example, and for-each has no default select so is
often used for "pull" things. Also of course for-each is far more
limited as it's equivaent to an apply template where every node is
matched by the same template.


David

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>