1

Pseudo table in relax ng compact:

   element books
       element book   
           element publisher
               element publisherinfo

The table (but in norwegian):

datatypes xsd = "http://www.w3.org/2001/XMLSchema-datatypes"

element bøker{
    element bok{
        attribute isbn{text},
        element title{text},
        element utgave{text},
        (element forfatter{text}
        |element redaktør{text}),
        element utgivelsesår{xsd:int},
        element fagfelt{text}*,
        element referans{text}?,
        element innholdsfortegnelse{
            element komponent{text}+
        },
        element forlag{
            text,
            element url{text},
            element kontaktinfo{
                element telefon{xsd:integer}?,
                element epost{text}?,
                element adresse{
                    element gate{text},
                    element gatenmr{text},
                    element postnmr{xsd:int}
                }?,
                element kontaktperson{
                    element navn{
                        element fnavn{text}+,
                        element mnavn{text}?,
                        element enavn{text}
                    },
                    element adresse{
                        element gate{text},
                        element gatenmr{text},
                        element postnmr{xsd:int}
                    }?,
                    element telefon{xsd:integer}?
               }?
           }
        }
    }*
}

Is there a way to iterate through this to find a publisher, and check if they have met these conditions (the publisher has released books with the topic (fagfelt) a AND b).

I want to find all publishers who have published books on both subjects only.

Should I rewrite this to make that a possibility or is there a way?

I'm inexperienced with XQuery and xml

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Peebl
  • 211
  • 3
  • 13
  • If I read your RelaxNG right I think you can get what you want with the following XPath expression: `//forlag[parent::bok[child::fagfelt='foo' and child::fagfelt='bar']]` That says, “Get all `forlag` elements with a parent `bok` element having both a child `fagfelt` element whose text content is `foo` and a child `fagfelt` element whose text content is `bar`”. That returns a set of all the matching elements; you can iterate through that with XQuery (or XSLT). – sideshowbarker May 05 '18 at 01:21

0 Answers0