It is with great relish that I announce that XML::XPathScript v1.47 is on its 
way to a CPAN mirror near you.

What is new in this release:

* template tag attributes can now be functions as well as strings.

    For example,

        $template->set( 'foo' => { testcode => sub {
                my( $n, $t ) = @_;
                my $name = $n->findvalue( 'name()' );
                $t->set({ pre => transfurbicate( $name ) }); 
                return $DO_SELF_AND_CHILDREN;
            } 
        } );

    can now be written

        $template->set( 'foo' => { pre => sub {
                my( $n, $t ) = @_;
                my $name = $n->findvalue( 'name()' );
                return transfurbicate( $name );
            } 
        } );


* The 'content' template attribute, which associates template elements to 
mini-stylesheets. 
    
    E.g., the code 

    <%
        $template->set( 'foo' => { 
                pre => '<newFoo foo_myattr="[EMAIL PROTECTED]" >',
                post => '</newFoo>',
                action => 'bar',        # only process 'bar' node children
        } );
    %>


        can now be written      

    <%
        $template->set( 'foo' => { content => <<'END_CONTENT' } );
            <newFoo foo_myattr="[EMAIL PROTECTED]" >  <%# look Ma, we 
interpolate! %>
                <%~ bar %>                    <%# only process bar children %>
            </newFoo>
    END_CONTENT
    %>
    <%# process all foo's %>
    <%~ //foo %>

    Or, to be more easy on the eye, we can use the short-hand version:

    <%@ foo
        <newFoo foo_myattr="[EMAIL PROTECTED]" >  <%# look Ma, we interpolate! 
%>
            <%~ bar %>                    <%# only proces bar children %>
        </newFoo>
    %>
    <%# process all foo's %>
    <%~ //foo %>


* B::XPath now a supported DOM tree. Bored with transforming XML documents? 
How about transforming Perl Optrees? :-)

        use B::XPath;
        use XML::XPathScript;

        sub guinea_pig {
            my $x = shift;
            print "oink oink " x $x;
        }

        my $xps = XML::XPathScript->new;

        $xps->set_dom( B::XPath->fetch_root( \&guinea_pig ) );
        $xps->set_stylesheet( '<%~ //print %>' );

        print $xps->transform;



Joy,
`/anick

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to