Changeset 13426 in project


Ignore:
Timestamp:
02/28/09 16:33:37 (11 years ago)
Author:
sjamaan
Message:

Document the sxpath function library procedures

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wiki/eggref/4/sxpath

    r13421 r13426  
    138138queries.
    139139
    140 === High-level interface
     140=== Primary interface
    141141
    142142The following procedures are the main interface one would use in
     
    302302
    303303
    304 === Low-level procedures
    305 
    306 These procedures can be used to create custom xpath parsers.
    307 
    308 TODO: document these
    309 
    310    txp:parameterize-parser
    311    sxml:whitespace
    312    txp:signal-semantic-error
    313    txp:error?
    314 
    315    sxml:core-last
    316    sxml:core-position
    317    sxml:core-count
    318    sxml:core-id
    319    sxml:core-local-name
    320    sxml:core-namespace-uri
    321    sxml:core-name
    322    sxml:core-string
    323    sxml:core-concat
    324    sxml:core-starts-with
    325    sxml:core-contains
    326    sxml:core-substring-before sxml:core-substring-after
    327    sxml:core-substring
    328    sxml:core-string-length
    329    sxml:core-normalize-space
    330    sxml:core-translate
    331    sxml:core-boolean
    332    sxml:core-not
    333    sxml:core-true
    334    sxml:core-false
    335    sxml:core-lang
    336    sxml:core-number
    337    sxml:core-sum
    338    sxml:core-floor
    339    sxml:core-ceiling
    340    sxml:core-round
    341    sxml:classic-params
     304=== XPath function library
     305
     306The procedures documented in this section can be used to implement a
     307custom xpath traverser.  Unlike the sxpath low-level procedures, they
     308are not in a separate library because they are in the same file as the
     309high-level procedures, so the library size is not impacted by
     310splitting them up.  When importing the {{txpath}} module you can
     311simply leave these procedures out, so splitting them up into a
     312separate library would provide no benefits.
     313
     314These procedures implement the core XPath functions, as described in
     315[[http://www.w3.org/TR/xpath#corelib|The XPath specification, section 4]].
     316
     317All of the following procedures return procedures that accept 4
     318arguments, which together make up (part of) the XPath context:
     319
     320  (lambda (nodeset root-node context var-binding) ...)
     321
     322The {{nodeset}} argument is the nodeset (a list of nodes) that is
     323currently under consideration.  The {{root-node}} argument is a
     324nodeset containing only one element: the root node of the document.
     325The {{context}} argument is a list of two numbers; the position and
     326size of the context.  The {{var-binding}} argument is an alist of
     327XPath variable bindings.
     328
     329The arguments to each of these core procedures, if any, are all
     330procedures of the same type as they return.  For example,
     331{{sxml:core-local-name}} accepts an optional procedure which accepts a
     332nodeset, a root-node, a context, a var-binding and returns a nodeset.
     333Of this nodeset, the local part of the name of the first node (if any)
     334is returned.  The values for each of these arguments are just those
     335passed to {{sxml:core-local-name}}.
     336
     337==== Node set functions
     338
     339* <procedure>(sxml:core-last)</procedure>
     340* <procedure>(sxml:core-position)</procedure>
     341* <procedure>(sxml:core-count node-set)</procedure>
     342* <procedure>(sxml:core-id object)</procedure>
     343* <procedure>(sxml:core-local-name [node-set])</procedure>
     344* <procedure>(sxml:core-namespace-uri [node-set])</procedure>
     345* <procedure>(sxml:core-name [node-set])</procedure>
     346
     347==== String functions
     348
     349* <procedure>(sxml:core-string [object])</procedure>
     350* <procedure>(sxml:core-concat [string ...])</procedure>
     351* <procedure>(sxml:core-starts-with string prefix)</procedure>
     352* <procedure>(sxml:core-contains string substring)</procedure>
     353* <procedure>(sxml:core-substring-before string separator)</procedure>
     354* <procedure>(sxml:core-substring-after string separator)</procedure>
     355* <procedure>(sxml:core-substring string numeric-offset [length])</procedure>
     356* <procedure>(sxml:core-string-length [string])</procedure>
     357* <procedure>(sxml:core-normalize-space [string])</procedure>
     358* <procedure>(sxml:core-translate string from to)</procedure>
     359
     360==== Boolean functions
     361
     362* <procedure>(sxml:core-boolean object)</procedure>
     363* <procedure>(sxml:core-not boolean)</procedure>
     364* <procedure>(sxml:core-true)</procedure>
     365* <procedure>(sxml:core-false)</procedure>
     366* <procedure>(sxml:core-lang lang-code)</procedure>
     367
     368==== Number functions
     369
     370* <procedure>(sxml:core-number [object])</procedure>
     371* <procedure>(sxml:core-sum node-set)</procedure>
     372* <procedure>(sxml:core-floor number)</procedure>
     373* <procedure>(sxml:core-ceiling number)</procedure>
     374* <procedure>(sxml:core-round number)</procedure>
     375
     376==== Parameter list
     377
     378<constant>sxml:classic-params</constant>
     379
     380This is a very long list of parameters containing parser and traversal
     381information for the textual xpath parser engine.  This corresponds to
     382the "function library" mentioned in the
     383[[http://www.w3.org/TR/xpath#section-Introduction|introduction of the XPath spec]].
     384You will have read the source code for details on how exactly to use it.
    342385
    343386
Note: See TracChangeset for help on using the changeset viewer.