# File lib/xtemplate/xpath.rb, line 183
      def sort(val, path=nil)
        if( val.is_a?(Array) )
          if( path )
            newval = val.sort{|x,y|
              path.split("/").each{|key|
                key.strip!
                if( x.is_a?(Hash) && y.is_a?(Hash) )
                  x,y = x[key], y[key]
                end
              }
              if( x.is_a?(Comparable) && y.is_a?(Comparable) )
                x <=> y
              else
                0
              end
            }
          else
            newval = val.sort{|x,y|
              if( x && y )
                x <=> y
              else
                0
              end
            }
          end
        else
          val
        end
      end