In my application I need to display a list of items derived from XML. Each item in the XML file belongs to a particular category. I want to display this information two ways, one way would group the items by category, the other would just list all the items. I've got a crude UI working but right now it displays all items in the XML under each category. I'm trying to create an Xpath which would let me select items which have a particular category. The tricky bit is that the category is contained in a subelement of the object I'm trying to find. For example, my data XML looks like this:

<items>
  <item name="Item 1">
      <categories>
         <category name="Category 1" />
      </categories>
  </item>
  <item name="Item 2">
      <categories>
         <category name="Category 2" />
      </categories>
  </item>
  <item name="Item 3">
      <categories>
         <category name="Category 1" />
         <category name="Category 3" />
      </categories>
  </item>
  <item name="Item 4">
      <categories>
         <category name="Category 2" />
         <category name="Category 4" />
      </categories>
  </item>
</items>

So, I have a UI component which displays all the Categories 1-4. Under Category 1, I want to find all 'item' elements who have a category element with an attribute equal to 'Category 1'. Under Category 2, I want to list all 'item' elements which have a category element with an attribute equal to 'Category 2', etc.

I'm sure there must be a way to do this, but it's escaping me at the moment.

Can anyone offer any Laszlo compatible xpath help?

Thanks

--
James Howe
_______________________________________________
Laszlo-user mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-user

Reply via email to