Re: [xsl] How to use Extensions

Subject: Re: [xsl] How to use Extensions
From: Alex Black <enigma@xxxxxxxxxxxxxxxx>
Date: Tue, 29 May 2001 11:10:22 -0700
> I guess you've noticed that the XSLT 1.0 spec says "This version of XSLT
> does not provide a mechanism for defining implementations of extensions."
> Instead, check out your XSLT processor's documentation: if it's written in
> Java, it should show you (and hopefully demonstrate!) the Java way to
> implement an extension element or function, and if it's written in C++, it
> should show you the C++ way. For further help, each processor usually has
> its own mailing list where you can find people more intimate with the inner
> workings of that processor; the coding of extensions is a popular topic on
> these lists.

Do you know of anyone doing anything similar to cocoon, i.e. "logic calls"
from within a stylesheet?

This is _sorely_ needed with php, at the moment some things with
php/xml/xslt are quite painful.

I would love to see an extension to sablotron to do this :)

for example:

<xsl:logic language="php">
    <?php for ($i=0, $i<10, $i++) { ?>
        <thing><?php echo $i; ?></thing>
    <?php } ?>
</xsl:logic>

within a stylesheet, where php is used to evaluate this block of code..
during the transformation.

actually, most of that use would be for things like:
    -math
    -values returned from queries
    -other xml trees which is makes sense to abstract

> As a bit of background, the XSLT 1.1 Working Draft, which seems to be on
> permanent back burner status while the Working Group focuses on XSLT 2.0,
> did offer a way to define extension functions right in your stylesheet. The
> disadvantages of this--mainly how it would encourage developers to put too
> much stylesheet logic in the JavaScript code in their xsl:script element
> instead of using the appropriate XSLT elements for this--were extensively
> debated on this mailing list.

Ah, even better: support for this concept seems to have made it into XSLT 2.
Do you know if they plan to have this generalized? i.e. you can say
something xslpish:

<xsl:logic language="php">
    <?php for ($i=0, $i<10, $i++) { ?>
        <thing><?php echo $i; ?></thing>
    <?php } ?>
</xsl:logic>


or something like:

<xsl:logic language="java">
    <% for (int i=0, i &lt; 10, i++) { %>
        <thing><% out.println(i) %></thing>
    <% } %>
</xsl:logic>

...

i.e. you can just pick your "logic handler"


_alex


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread