Was this page helpful?

Web.List

    Table of contents
    1. 1. Usage Restrictions
    2. 2. Parameters
    3. 3. Result
    4. 4. Samples
    web.List(source : str, xpath : str, namespaces : map, xml : bool, ttl: num) : list

    Convert source to a list of text values by optionally fetching and parsing it.

    Usage Restrictions

    1.9.1 or later

    Parameters

    Name Type Description
    source str XML source text or source uri
    xpath str xpath to list of values
    namespaces map (optional, default: none) XML namespace definitions
    xml bool (optional, default: false) Capture enclosing XML element
    ttl num (optional, range: 60 - 86400, default: 300) caching durations in seconds (requires 8.08 or later)

    Result

    This function behaves similarly to web.text except that it returns the text value of all XML nodes matched by the xpath expression instead of only the first one.

    NOTE: all web.* functions are limited to reading at most 500KB of data from a URI.

    Samples

               Output

    To retrieve the bulleted list items:

    {{ web.List("<ul><li>item 1</li><li>item 2</li></ul>", "/ul/li") }}

    [ "item 1", "item 2" ]

              

    Was this page helpful?
    Tag page
    You must login to post a comment.

    Copyright © 2011 MindTouch, Inc. Powered by