xmlrangexpointer

What's the point (no-pun) of XPointer ranges?


XPointer spec talks about ranges that, as far as I understand, mean you can target two nodes in an XML document and get everything in between them or something. Do people really use this? What is it useful for?


Solution

  • I have never used this, actually. But when I work with XSLT, I quite often find myself needing a way of expressing a range (i.e., "select all nodes from xpathX to xpathY") and a bit depending on the structure, it is quite hard to do this correct. Like I said, I don't use it, but if I could apply XPointer in my projects, I would use it if this feature was implemented.

    You ask what it is useful for. A simple example: consider a log file. You can simply request a range from point X to Y (i.e., a date range), which can be far easier then the classical approach with XPath. I.e., it is easier and clearer to express.