-
Notifications
You must be signed in to change notification settings - Fork 38
Parsley Functions
fizx edited this page Sep 13, 2010
·
6 revisions
Parselets can be written in JSON, XML, or language-specific data structures in (currently) Ruby and Python.
Parselets support a combination of CSS, Xpath, and XSLT functions and selectors, as well as some built-in functions. Custom Functions are also supported.
Available functions:
-
All Xpath functions, and the leading
fn:
is not required -
All of CSS3 selectors, except selectors that don’t make sense without a mouse, such as
:hover
- Parsley functions:
-
parsley:html-document(uri)
which fetches an html page from the uri, and parses it. For example:parsley:html-document("http://google.com")//title
-
parsley:nl
which normalizes text containing<p>
,<br>
‘s, etc. into plain text. (Remember: ’nl’ stands for ‘new line’.)
-
- And from EXSLT:
- date:add-duration
- date:add
- date:date-time
- date:date
- date:day-abbreviation
- date:day-in-month
- date:day-in-week
- date:day-in-year
- date:day-name
- date:day-of-week-in-month
- date:difference
- date:duration
- date:hour-in-day
- date:leap-year
- date:minute-in-hour
- date:month-abbreviation
- date:month-in-year
- date:month-name
- date:second-in-minute
- date:seconds
- date:sum
- date:time
- date:week-in-month
- date:week-in-year
- dyn:evaluate
- math:abs
- math:acos
- math:asin
- math:atan
- math:atan2
- math:constant
- math:cos
- math:exp
- math:highest
- math:log
- math:lowest
- math:max
- math:min
- math:power
- math:random
- math:sin
- math:sqrt
- math:tan
- regexp:match
- regexp:replace
- regexp:test
- set:difference
- set:distinct
- set:has-same-node
- set:intersection
- set:leading
- set:trailing
- str:align
- str:concat
- str:decode-uri
- str:encode-uri
- str:padding
- str:split
- str:tokenize