matts       2005/04/20 13:02:14

  Modified:    lib/Apache/AxKit/Language XSP.pm
  Log:
  Support namespace prefixed attributes
  
  Revision  Changes    Path
  1.53      +17 -1     xml-axkit/lib/Apache/AxKit/Language/XSP.pm
  
  Index: XSP.pm
  ===================================================================
  RCS file: /home/cvs/xml-axkit/lib/Apache/AxKit/Language/XSP.pm,v
  retrieving revision 1.52
  retrieving revision 1.53
  diff -u -r1.52 -r1.53
  --- XSP.pm    31 Oct 2003 17:04:46 -0000      1.52
  +++ XSP.pm    20 Apr 2005 20:02:14 -0000      1.53
  @@ -743,8 +743,24 @@
           }
       }
       elsif ($tag eq 'attribute') {
  +        if (my $uri = $attribs{uri}) {
  +            # handle NS attributes
  +            my $prefix = $attribs{prefix} || die "No prefix given";
  +            my $name = $attribs{name} || die "No name given";
  +            $e->{attrib_seen_name} = 1;
  +            return '$parent->setNamespace('.makeSingleQuoted($uri).', '.
  +                                            makeSingleQuoted($prefix).', 
0);'.
  +                   '$parent->setAttribute('.makeSingleQuoted($name).', ""';
  +        }
           if (my $name = $attribs{name}) {
               $e->{attrib_seen_name} = 1;
  +            # handle prefixed names
  +            if ($name =~ s/^(.*?)://) {
  +                my $prefix = $1;
  +                return 'my $nsuri = $parent->lookupNamespaceURI(' . 
makeSingleQuoted($prefix) . ')'.
  +                        ' || die "No namespace found with given 
prefix";'."\n".
  +                        
'$parent->setAttributeNS($nsuri,'.makeSingleQuoted($name).', ""';
  +            }
               return '$parent->setAttribute('.makeSingleQuoted($name).', ""';
           }
           $e->{attrib_seen_name} = 0;
  
  
  

Reply via email to