...
# into 1. blah
sub section_title {
    my ( $self, $node, $args ) = @_;
    my $section_nbr = $self->stash->{section_nbr}++;
    return $section_nbr . ". " . $node->findvalue( '@title' );
}
```
By default, the stash is cleared when rendering a document.
To change this behavior, see ["use\_clean\_stash" in XML::XSS::Document](https://metacpan.org/pod/XML::XSS::Document#use_clean_stash).
### stash()
The attribute getter.
### clear\_stash()
Clear the stash.
# OVERLOADING
## Concatenation (.)
The concatenation operator is overloaded to behave as an alias for `get()`.
```perl
my $chapter = $xss.'chapter';           # just like $xss->get('chapter')
$chapter->set_pre( '' );
$chapter->set_post( '
' );
```
Gets really powerful when used in concert with the overloading of the rules
and style attributes:
```
# equivalent as example above
$xss.'chapter'.'pre'  *= '';
$xss.'chapter'.'post' *= '
';
```
# METHODS
## set( $element\_1 => \\%attrs, $element\_2 => \\%attrs\_2, ... )
Sets attributes for a rendering node. 
The `$name` can be 
an XML element name, or one of the special keywords `#document`,
`#text`, `#comment`, `#pi` or `*` (for the
_catch-all_ element), 
which will resolve to the corresponding rendering object.
```perl
$xss->set( 'foo' => { rename => 'bar' } );
# same as $xss->element('foo')->set( rename => 'bar' );
$xss->set( '#text' => { filter => { uc shift } } );
# same as $xss->text->set( filter => { uc shift } );
```
Note that subsequent calls to `set()` are additive. I.e.:
```perl
$xss->set( foo => { pre => 'X' } );
$xss->set( foo => { post => 'Y' } );  # pre is still set to 'X'
```
If you want to delete an attribute, passes it `undef` as its 
value.
## render( $xml, \\%args )
Returns the output produced by the application of the 
stylesheet to the xml document.  The xml can
be passed as a string, or as a `XML::LibXML` object.
Several `XML::LibXML` objects can also be passed, in
which case the return value will be the concatenation
of their transformations.
```perl
my $sections = $xss->render( $doc->findnodes( 'section' ) );
```
The `%args` is optional, and will defaults to an empty
hash if not provided.  The reference to `%args` is also passed to
the recursive calls to `render()` for the children of the processed
node, which allows for another way for parent/children nodes to pass
information in addition to the `stash`.
```perl
# count the descendents of all nodes
$xss->set(
    '*' => {
        process => sub {
            my ( $self, $node, $attrs ) = @_;
            $attrs->{children}++;
            return 1;
        },
        content => sub {
            my ( $self, $node, $attrs ) = @_;
            my %c_attrs;
            my $c_ref = \%c_attrs;
            my $output = $self->render( $node->childNodes, $c_ref );
            $attrs->{children} += $c_ref->{children};
            $self->{post} =
            "\n>>> node has " 
                . ($c_ref->{children}||0) 
                . " descendents\n";
            return $output;
        },
    } );
```
# AUTHOR
Yanick Champoux  [](http://coderwall.com/yanick)
# COPYRIGHT AND LICENSE
This software is copyright (c) 2017, 2013, 2011, 2010 by Yanick Champoux.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.