/jcr:root/path/to/products/root//element(*, product)[jcr:contains(categories/*/., 'categoryA')]
should do the trick. However I have not tested it of course. -will On 17.02.2010, at 08:18, Paul Fitchett wrote: > > > Hi, > OK, that looks like my second approach, the data for which is easy enough to > construct in my import handler. > > However, I am unable to construct an XPATH or SQL query to get the nodes > that I want. XPATH has never been my friend... > > Given your structure, the query in words would be: "return the product nodes > that have a categories node below them that has a node data that has a value > of categoryA". I don't know how to construct such a query. > > An alternative structure could be the following: > > - product > - name: Product A > - price: 33.99 > - categories: > - categoryA > - categoryB > > then a query like "//product/*/categories/categoryA" will return the right > subset, but it will be the categoryA nodes rather than the product nodes, > while "//product/*/categories/categoryA/../.." says "Parent axis is not > supported"... > > Any help appreciated! > > Cheers, > Paul Fitchett > > > > Will Scheidegger wrote: >> >> >> On 17.02.2010, at 02:43, Paul Fitchett wrote: >>> I believe that Magnolia does not support multi-value attributes,... >> >> It does and it does it well. >> Use the "checkBox" control (see [1]). If you add a checkBox control named >> categories to your product dialog and configure it with your categories as >> options you can simply check the categories you want. You will then end up >> with a data structure like this for example: >> >> - product >> - name: Product A >> - price: 33.99 >> - categories: >> - 0: categoryA >> - 1: categoryB >> >> Now all you have to do is write a query which gets the products that have >> your categories checked (XPATH is your friend). >> >> -will >> >> [1]: >> http://documentation.magnolia-cms.com/reference/dialogs/controls.html#checkBoxControl >> >> ---------------------------------------------------------------- >> For list details see >> http://www.magnolia-cms.com/home/community/mailing-lists.html >> To unsubscribe, E-mail to: <[email protected]> >> ---------------------------------------------------------------- >> >> >> > > -- > View this message in context: > http://old.nabble.com/What-is-best-practice-for-categorising-and-querying-loaded-data--tp27617942p27619872.html > Sent from the Magnolia - User mailing list archive at Nabble.com. > > > ---------------------------------------------------------------- > For list details see > http://www.magnolia-cms.com/home/community/mailing-lists.html > To unsubscribe, E-mail to: <[email protected]> > ---------------------------------------------------------------- > ---------------------------------------------------------------- For list details see http://www.magnolia-cms.com/home/community/mailing-lists.html To unsubscribe, E-mail to: <[email protected]> ----------------------------------------------------------------
