-
a<c       s    d  Z    d k Z d k Z d k Z d k Z  d k l Z l Z  d k l	 Z	  d k
 l Z  d k l Z l Z l Z l Z  d   Z  d   Z ( e d  Z 1 e d	  Z < e d
  Z W e d  Z u d   Z  d   Z  e d  Z  d   Z  d   Z  y  d k Z  d   Z Wn   e Z n X d   Z   e d  Z!  e d  Z"  d   Z#  d   Z$  d   Z%  h  e e d f <e e d f <e i& d j o e p e e d f <e e d f <e e d f <e e d f <e e d f <e  e d  f <e! e d! f <e" e d" f <e# e d# f <e$ e d$ f <e% e d% f <e e d& f <e e d' f <e e d( f <e e d) f <e e d f <e e d f <e i& d j o e p e e d f <e e d f <e e d f <e e d f <e e d f <e  e d  f <e! e d! f <e" e d" f <e# e d# f <e$ e d$ f <e% e d% f <e e d& f <e e d' f <Z' d S(*   s   
4XPath-specific Extension functions
WWW: http://4suite.org/XSLT        e-mail: support@4suite.org

Copyright (c) 2000-2001 Fourthought Inc, USA.   All Rights Reserved.
See  http://4suite.org/COPYRIGHT  for license and copyright information
N(   s   Nodes   EMPTY_NAMESPACE(   s   Text(   s   boolean(   s   CoreFunctionss   Conversionss   FT_EXT_NAMESPACEs   FT_OLD_EXT_NAMESPACEc    s9     y  d k  l }  | SWn   d Sn Xd  S(   N(   s   __version__s   0.11.1(   s   Ft.__init__s   __version__(   s   contexts   __version__(    (    sP   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/xpath/BuiltInExtFunctions.pys   Version s
   c    s      t  |  t  g   j o   | Sn ! t | d  o | i t i j o " t | i  } n $ | g } % | Sd S(   s,   Convert a result-tree fragment to a node-sets   nodeTypeN(	   s   types   rtfs   hasattrs   nodeTypes   Nodes   DOCUMENT_NODEs   lists
   childNodess   node_set(   s   contexts   rtfs   node_set(    (    sP   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/xpath/BuiltInExtFunctions.pys   NodeSet s   &c    sg   ( ) * | o + |  i } n , t i |  } - t i | |  o t i	 p t i
 } . | Sd S(   s2   Do a regular expression match against the argumentN(   s   args   contexts   nodes   Conversionss   StringValues   res   matchs   patterns   booleans   trues   falses   bool(   s   contexts   patterns   args   bool(    (    sP   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/xpath/BuiltInExtFunctions.pys   Match( s   )c    sq   1 2 3 | o 4 |  i } n 5 t i |  } 6 t i |  } 7 t i |  } 8 t i | | |  Sd S(   s5   Do a global search and replace of the string contentsN(	   s   args   contexts   nodes   Conversionss   StringValues   olds   news   strings   replace(   s   contexts   olds   news   arg(    (    sP   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/xpath/BuiltInExtFunctions.pys   Replace1 s   c 	   s  < = > | o ? |  i } n @ t i |  } A t i | |  } B |  i	 } C g  } D x| DD ]} E | i   F | i d i d t  G t |  t f   j o H | f } n I xY | DI ]N } J | i d i d t  K | i d i |  L | i d i d  q WM | i d i d  N | i   } O |  i i |  P | i | i d  qg WQ | Sd S(   sJ   Do a regular expression search against the argument (i.e. get all matches)is   Matchs   Groupi    N(   s   args   contexts   nodes   Conversionss   StringValues   res   findalls   patterns   matchess	   processors   procs   matches_nodesets   groupss
   pushResults   writerss   startElements   EMPTY_NAMESPACEs   types   groups   texts
   endElements	   popResults   frags   rtfss   appends
   childNodes(	   s   contexts   patterns   args   frags   procs   groups   matchess   groupss   matches_nodeset(    (    sP   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/xpath/BuiltInExtFunctions.pys   SearchRe< s.   	
 	
 	c 
   s  W X Y | o Z |  i } n [ t i |  } \ |  i }	 ] g  } ^ t i	 |  } _ | i |  } ` x:` | o/a |	 i   b |	 i d i d t  c | i   } e | o e t | i    } n f x` | Df ]U } g |	 i d i d t  j |	 i d i | p d  k |	 i d i d  q Wl |	 i d i d  m |	 i   } n |  i i |  o | i | i d  p | i | | i    } qr Wq | Sd S(   sJ   Do a regular expression search against the argument (i.e. get all matches)is   Matchs   Groups    i    N(   s   args   contexts   nodes   Conversionss   StringValues	   processors   procs   matches_nodesets   res   compiles   patterns   _res   searchs   _matchs
   pushResults   writerss   startElements   EMPTY_NAMESPACEs   groupss   _groupss   tuples   groups   texts
   endElements	   popResults   frags   rtfss   appends
   childNodess   end(
   s   contexts   patterns   args   _groupss   groups   _res   _matchs   matches_nodesets   frags   proc(    (    sP   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/xpath/BuiltInExtFunctions.pys   SearchRePy20W s4   	 
 
 	 c    sI  u   t  | d |  i \ } }  t i t  p t	 i	 i t t
  }  | o  t d |   n  t g t |  }  d   }	  t t |	 | f |  }
  |  i }  g  }  xw |
 D ]l }  | i    | i d i t i |    | i   }  |  i  i! |   | i! | i" d  q W | Sd S(   s  
    Apply the function serially over the given node sets.
    In iteration i, the function is passed N parameters
    where N is the number of argument node sets.  Each
    parameter is a node set of size 1, whose node is
    the ith node of the corresponding argument node set.
    The return value is a node set consisting of a series
    of result-tree nodes, each of which is a text node
    whose value is the string value of the result of the
    ith function invocation.
    Warning: this function uses the implied ordering of the node set
    Based on its implementation as a Python list.  But in reality
    There is no reliable ordering of XPath node sets.
    In other words, this function is voodoo.
    s
   namespacess*   Dynamically invoked function %s not found.c    s    t  | |  S(   N(   s   applys   fs   args(   s   xs   fs   args(    (    sP   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/xpath/BuiltInExtFunctions.pys   <lambda> s    ii    N(#   s   ExpandQNames   funcnames   contexts   processorNsss   prefixs   locals   g_extFunctionss   gets   expandeds   CoreFunctionss   Nones   funcs	   Exceptions   fs   lens   nodesetss   flists   lfs   applys   maps   retlists	   processors   procs   result_nodesets   rets
   pushResults   writerss   texts   Conversionss   StringValues	   popResults   frags   rtfss   appends
   childNodes(   s   contexts   funcnames   nodesetss   frags   locals   result_nodesets   prefixs   funcs   flists   lfs   retlists   rets   proc(    (    sP   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/xpath/BuiltInExtFunctions.pys   Mapu s$   (	
 	 c    s#      t  i t i |   Sd S(   s"   Escape illegal characters in a URLN(   s   urllibs   quotes   Conversionss   StringValues   url(   s   contexts   url(    (    sP   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/xpath/BuiltInExtFunctions.pys	   EscapeUrl s   c    s      | o  |  i g } n  t | d d  o  | d i Sn*  t | d d  o  | d i Sn  d Sd S(   s    Get the base URI of the argumenti    s   baseUris   refUris    N(   s   args   contexts   nodes   hasattrs   baseUris   refUri(   s   contexts   arg(    (    sP   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/xpath/BuiltInExtFunctions.pys   BaseUri s   c    s5     d  k  }  | i   }  | i i |  Sd  S(   N(   s   DateTimes   nows   ds   ISOs   str(   s   contexts   ds   DateTime(    (    sP   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/xpath/BuiltInExtFunctions.pys   IsoTime s   c    s5     d  k  }  | i i t i t  d |  Sd  S(   Ns   context(   s	   xml.xpaths   xmls   xpaths   Evaluates   Conversionss   StringValues   sts   context(   s   contexts   exprs   xml(    (    sP   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/xpath/BuiltInExtFunctions.pys   Evaluate s   c    s-     d k  l }  | i | i    Sd  S(   N(   s   Uuid(   s   Ft.Libs   Uuids   UuidAsStrings   GenerateUuid(   s   contexts   Uuid(    (    sP   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/xpath/BuiltInExtFunctions.pys   GenerateUuid s   c    sy     t  |  t  g   j o  t d   n  h  }  x' | D ] }  | | t i |  <qE W | i   Sd  S(   Ns.   'distinct' parameter must be of type node-set!(   s   types   nodesets	   Exceptions   nodess   nodes   Conversionss   StringValues   values(   s   contexts   nodesets   nodes   nodes(    (    sP   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/xpath/BuiltInExtFunctions.pys   distinct s   	
 	c    s     |  i }  x  | i o  | i } q W g  }  x? t i t i |  |  D ] }  | i | i |   q[ W | Sd  S(   N(   s   contexts   nodes   docs
   parentNodes   nodesets   strings   splits   Conversionss   StringValues   args   delims   tokens   appends   createTextNode(   s   contexts   args   delims   tokens   docs   nodeset(    (    sP   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/xpath/BuiltInExtFunctions.pys   split s    	 	c    sM     t  d   |  }  | o  t i | |  Sn  t i |  Sd  S(   Nc    s    t  i |   S(   N(   s   Conversionss   StringValues   x(   s   x(    (    sP   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/xpath/BuiltInExtFunctions.pys   <lambda> s    (   s   maps   nodesets   compss   delims   strings
   joinfields(   s   contexts   nodesets   delims   comps(    (    sP   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/xpath/BuiltInExtFunctions.pys   join s   
c    s     |  i }  x  | i o  | i } q W t i |  }  t i |  }  g  }  x9 t	 | |  D ]% }  | i | i t |    qs W | Sd  S(   N(   s   contexts   nodes   docs
   parentNodes   Conversionss   NumberValues   los   his   nodesets   xranges   numbers   appends   createTextNodes   str(   s   contexts   los   his   docs   nodesets   number(    (    sP   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/xpath/BuiltInExtFunctions.pys   range s    	 	#c    s,     t  i |  o  | Sn  | Sd  S(   N(   s   Conversionss   BooleanValues   conds   v1s   v2(   s   contexts   conds   v1s   v2(    (    sP   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/xpath/BuiltInExtFunctions.pys   if_function s   c    s,     t  i t i |  t i |   Sd  S(   N(   s   strings   finds   Conversionss   StringValues   outers   inner(   s   contexts   outers   inner(    (    sP   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/xpath/BuiltInExtFunctions.pys   find s   s   node-sets   matchi  s	   search-res   base-uris
   escape-urls   iso-times   evaluates   distincts   splits   joins   ranges   ifs   finds   maps   versions   generate-uuids   replace((   s   __doc__s   syss   res   strings   urllibs   xml.doms   Nodes   EMPTY_NAMESPACEs   xml.dom.Texts   Texts	   xml.utilss   booleans	   xml.xpaths   CoreFunctionss   Conversionss   FT_EXT_NAMESPACEs   FT_OLD_EXT_NAMESPACEs   Versions   NodeSets   Nones   Matchs   Replaces   SearchRes   SearchRePy20s   Maps	   EscapeUrls   BaseUris   IsoTimes   Evaluates   Ft.Lib.DumpBgTuples   Fts   GenerateUuids   distincts   splits   joins   ranges   if_functions   finds
   hexversions   ExtFunctions(    s   CoreFunctionss	   EscapeUrls   BaseUris   joins   Evaluates   IsoTimes   Nodes   syss   Versions   EMPTY_NAMESPACEs   FT_OLD_EXT_NAMESPACEs   Fts   ExtFunctionss   finds   Matchs   strings   Conversionss   Maps   if_functions   SearchRePy20s   distincts   Texts   urllibs   Replaces   res   ranges   booleans   splits   FT_EXT_NAMESPACEs   SearchRes   GenerateUuids   NodeSet(    (    sP   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/xpath/BuiltInExtFunctions.pys   ? s8   '"	$

