[
Lists Home |
Date Index |
Thread Index
]
"DuCharme, Bob (LNG-CHO)" <bob.ducharme@lexisnexis.com> wrote in message
FEF4858E8AB32D4EAC2CF2A7D85386EB0B2543A4@lnxdayexch06b.lexis-nexis.com">news:FEF4858E8AB32D4EAC2CF2A7D85386EB0B2543A4@lnxdayexch06b.lexis-nexis.com...
> Jonathan Robie wrote:
>>Dimitre Novatchev
>
>>> To avoid recursion in tree processing (isn't this what XSLT and XQuery
>>> are all about)? This should be impossible by definition.
>
>>I think you are confusing recursive data structures, which both languages
> must be
>>able to handle, with recursive algorithms.
>
> To amplify what Jonathan wrote, by recursion I was referring to algorithms
> and not data structures--in particular, the use of XSLT 1.0 named
> templates
> that call themselves to accomplish things that can be accomplished more
> intuitively for most people with procedural code in other languages. For
> example, the repetition of something a fixed number of times.
And by recursive processing I meant such simple and fundamental things like
the identity transformation (XSLT 1.0 terminology):
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
Overriding the identity template rule (XSLT 2.0 terminology) provides an
elegant and powerful pattern for solving a large class of tree
transformation problems.
Compared to it, the non-recursive solutions are more clumsy and unnatural
and in some cases may be very difficult to produce.
There are different types of programmers -- it is as difficult for followers
of the functional programming school not to use recursion as to use
recursion for programmers from the procedural school.
But this reflects individual way of thinking -- not the nature of the
problems being solved, large group of which are inherently recursive.
Cheers,
Dimitre.
>
> When I mentioned XSLT developers who don't use recursion in an earlier
> posting, I was referring to the ones who avoid the use of recursive named
> templates.
>
> Bob DuCharme www.snee.com/bob <bob@
> snee.com> weblog on linking-related topics:
> http://www.oreillynet.com/pub/au/1191
>
>
> -----------------------------------------------------------------
> The xml-dev list is sponsored by XML.org <http://www.xml.org>, an
> initiative of OASIS <http://www.oasis-open.org>
>
> The list archives are at http://lists.xml.org/archives/xml-dev/
>
> To subscribe or unsubscribe from this list use the subscription
> manager: <http://www.oasis-open.org/mlmanage/index.php>
>
>
|