Possible to address nodes with Xpath in a 2-dimensional hierarchy?

Viewed 100

Let's take the Excel Pivot data structure (or concept), where we have a hierarchy on the Rows (x-) and on the Cols (y-axis).

enter image description here

Would it be possible (or have any attempts been made) to address location in the pivot table using XPath? I know there is MDX for a cube which I'm familiar with (of n-Dimensionality, or so it says, but in actuality the display is almost always in 2-dimensions), but what about using Xpath to do the same? For example, to address the Cat (subtotal) row, it seems like the following could be used:

Format: (Rows(Xpath), Cols(Xpath), Vals(List))

(
    Rows:   '//Animal[@Value="Cat"]',
    Cols:   '//' (or empty --> means everything)
    Vals:   '', empty for all values, or a list of the specific values
)

A few more examples:

Row for Dog named Sally
('//Animal[@value="Dog"]/Name[@value="Sally"],,)

Column for F(emale) dogs
(,'//Gender[@value="F"],)

Value ("cell") for Booker, Male
('//Animal[@value="Cat"]/Name[@value="Booker"]', '//Gender[@value="M"]', )

Rows for Book, Pebbles
('//Animal[@value="Cat"]/Name[@value="Booker" or @value="Tood",,)

Would this be a valid way to address a two-dimensional Pivot? What might be the challenges if any of using this approach? Note the above pivot table probably isn't the best example because an animal will be either M or F but not both, so that column is in effect irrelevant, but even so hopefully it's a good-enough of an example to communicate my intent.

0 Answers
Related