Skip Menu |

This queue is for tickets about the XML-XSLT CPAN distribution.

Report information
The Basics
Id: 18476
Status: resolved
Priority: 0/
Queue: XML-XSLT

People
Owner: Nobody in particular
Requestors: jdhedden [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Unimportant
Broken in: 0.48
Fixed in: (no value)



Subject: Debug indentation problem
With debug output, there are more indents than outdents so that the output continually moves out to the left. That attached patch corrects this.
Subject: xml_xslt_indent.patch
--- XSLT.pm.orig 2006-03-31 09:08:02.000000000 -0500 +++ XSLT.pm.indent 2006-03-31 09:20:12.000000000 -0500 @@ -1712,6 +1712,7 @@ my $node = $self->_get_node_set( $path, $self->xml_document(), $current_xml_selection_path, $current_xml_node, $variables ); + $self->_outdent(); if (@$node) { $current_xml_node = $$node[0]; @@ -1720,7 +1721,6 @@ { return ""; } - $self->_outdent(); } else { @@ -1733,6 +1733,7 @@ if (@$node) { $self->debug("path exists!"); + $self->_outdent(); return "true"; } else @@ -1969,7 +1970,7 @@ $count++; } - $self->_indent(); + $self->_outdent(); } sub _for_each @@ -2483,7 +2484,9 @@ if ( $ref eq "ARRAY" ) { - return $self->__string__( $$node[0], $depth ); + my $str = $self->__string__( $$node[0], $depth ); + $self->_outdent(); + return $str; } else { @@ -2578,12 +2581,14 @@ { # node-set array-ref + $self->_outdent(); return $$variables{$varname}; } elsif ( ref( $$variables{$varname} ) eq 'XML::DOM::NodeList' ) { # node-set nodelist + $self->_outdent(); return [ @{ $$variables{$varname} } ]; } elsif ( @@ -2591,11 +2596,13 @@ { # node-set documentfragment + $self->_outdent(); return [ $$variables{$varname}->getChildNodes ]; } else { # string or number? + $self->_outdent(); return [ $self->xml_document() ->createTextNode( $$variables{$varname} ) ]; } @@ -2603,12 +2610,14 @@ else { # var does not exist + $self->_outdent(); return []; } } elsif ( $path eq $current_path || $path eq 'self::node()' ) { $self->debug("direct hit!"); + $self->_outdent(); return [$current_node]; } else @@ -2709,6 +2718,7 @@ # /.. # $self->debug(qq{getting parent ("$path")}); + $self->_outdent(); return &__parent__( $self, $path, $node, $silent ); } @@ -2717,6 +2727,7 @@ # /@attr # $self->debug(qq{getting attribute `$1' ("$path")}); + $self->_outdent(); return &__attribute__( $self, $1, $path, $node, $silent ); } @@ -2727,6 +2738,7 @@ # //elem[n] # $self->debug(qq{getting deep indexed element `$1' `$2' ("$path")}); + $self->_outdent(); return &__indexed_element__( $self, $1, $2, $path, $node, $silent, "deep" ); @@ -2736,6 +2748,7 @@ # //elem # $self->debug(qq{getting deep element `$1' ("$path")}); + $self->_outdent(); return &__element__( $self, $1, $path, $node, $silent, "deep" ); } @@ -2744,6 +2757,7 @@ # /elem[n] # $self->debug(qq{getting indexed element `$2' `$3' ("$path")}); + $self->_outdent(); return &__indexed_element__( $self, $2, $3, $path, $node, $silent ); } @@ -2752,6 +2766,7 @@ # /text() # $self->debug(qq{getting text ("$path")}); + $self->_outdent(); return &__get_nodes__( $self, TEXT_NODE, $path, $node, $silent ); } @@ -2760,6 +2775,7 @@ # /processing-instruction() # $self->debug(qq{getting processing instruction ("$path")}); + $self->_outdent(); return $self->__get_nodes__(PROCESSING_INSTRUCTION_NODE, $path, $node, @@ -2771,6 +2787,7 @@ # /comment() # $self->debug(qq{getting comment ("$path")}); + $self->_outdent(); return &__get_nodes__( $self, COMMENT_NODE, $path, $node, $silent ); } @@ -2779,6 +2796,7 @@ # /elem # $self->debug(qq{getting element `$2' ("$path")}); + $self->_outdent(); return &__element__( $self, $2, $path, $node, $silent ); } @@ -2786,6 +2804,7 @@ { $self->warn( "get-node-from-path: Don't know what to do with path $path !!!"); + $self->_outdent(); return []; } }
On Fri Mar 31 09:34:04 2006, JDHEDDEN wrote: Show quoted text
> With debug output, there are more indents than outdents so that the > output continually moves out to the left. That attached patch corrects > this.
Hi, I belatedly applied this with https://github.com/jonathanstowe/XML-XSLT/commit/ee1792c5b28d55e93fccfd0642d7abeec0a1877a there were one or two rejections, so if you are still concerned it might be nice to check and fix the remaining oddities :)