+ Reply to Thread
Results 1 to 3 of 3

Thread: Extend XPath implementation

  1. #1

    Default Extend XPath implementation

    The inclusion of web.text('uri','xpath') in Itasca is tremendous -- it makes it possible to create some really cool dashboards within our Wiki. It would be ever-so-much-cooler if we could use operators in XPath expressions, as described in http://www.w3.org/TR/xquery-operators/. In the simplest case, I'd like to add two elements together from an XML source.

    What would be even better than that would be the ability to format the data in a straightforward manner (a la XSL; e.g., <xsl:value-of select="format-number(root/foo/bar+root/spleet/splat, '#,###.00')"/>). Perhaps there's already a way to get the format I want somewhere in this vast DekiWiki, but I haven't spotted it yet.

  2. #2
    Join Date
    Jul 2006
    Location
    San Diego, CA
    Posts
    5,450

    Default

    XPath and XQuery are quite a bit different. XPath 2.0 adds a lot of capabilities found in XQuery, but it's not yet supported by Mono.

    However, you can do your operations in Deki Script as well. Deki Script automatically converts from text to numbers and vice versa when needed.
    For example:
    Code:
    {{ web.text(source, xpath1) + web.text(source, xpath2) }}
    You can even do conditionals, like so:
    Code:
    {{ web.text(source, xpath1) > 100 ? web.text(source, xpath2) : web.text(source, xpath3)}}
    web.text caches the document for a short duration to make repeated access to it much faster. So, feel free to run as many xpaths over it as you like in a single page.

    num.format() is being added in 1.9.0b (it's similar to date.format, but for numbers).

    What would be really awesome, is you could do a write-up on how you're using it to build dashboards for your wiki. I'm sure others would love to read about it!
    Steve G. Bjorg - Chief Architect
    Did you check the MindTouch FAQ?
    Found a bug? Report it.
    Follow me on Twitter
    Find us on IRC: irc.freenode.net #mindtouch

  3. #3

    Default

    Great stuff -- I'll definitely make use of that! Our dashboards are fairly simple at the moment -- I have XML extracts of production systems, and I make them available internally as dashboards by inserting them as iframes with XSLT. With Deki, I'm able to craft Wiki pages with the same data (although I'm a bit limited in formatting the numbers at the moment). I'm working through many of our dashboards, creating a spot in our wiki "tree" that people can then refer to and insert into their own home pages via wiki.page("uri").

    One thing I can do in an iframe that I need to figure out how to do in Deki -- auto refresh. The underlying XML for these dashboards get fresh data on a regular interval (say, hourly), and I'd like people's implementation of these dashboards to refresh automatically as well. If I figure out how to do that, I suppose I can make templates for others to use as their own home pages with refresh built in.

+ Reply to Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts