From: Loren C. <lor...@gm...> - 2021-02-04 20:55:54
|
I use the call: let $is-foo := (functx:namespaces-in-use($xml-doc/node()) = "http://www.foo.com/bar") I have a conditional and use a different function module based on one of the namespaces of the document. > On Feb 4, 2021, at 12:08 PM, Joe Wicentowski <jo...@gm...> wrote: > > Hi Guillaume, > > Short of normalizing the data, namespace wildcards are the most general purpose solution for path expressions. > > You can also use the local-name() function, e.g., > > /*[local-name() eq "table"]/*[local-name() eq "tr"]/*[local-name() eq "td"] > > To really be sure you're not inadvertently including other namespaces, you could declare all of the namespaces and explicitly select these in your node tests with the union operator: > > /(v12:table|v13:table|v14:table)/(v12:tr|v13:tr|v14:tr)/(v12:td/v13:td/v14:td) > > It's hard to comment on performance concerns without knowing what kinds of queries you need to run, but you might consider eXist 5's fields and facets as part of your arsenal: you could construct a field with an expression that selects the content you need, and then you could query the field without worrying about which namespace the source came from. (I think.) > > Joe > > On Thu, Feb 4, 2021 at 11:26 AM Guillaume Mella <gui...@un... <mailto:gui...@un...>> wrote: > Hello, > > I have a module which consumes VOTable (table/tr/td with meta data for Astronomy) using a standardised TableAccesProtocol. But depending on the data provider the returned document may get multiple namespaces depending on the version they implement, eg.: > > declare namespace votable="http://www.ivoa.net/xml/VOTable/v1.2" <http://www.ivoa.net/xml/VOTable/v1.2>; (: could be v1.3 v1.4 :) > > Most data part are the same in the various versions and I would like to support it dynamically without branching/duplication/copy. > > I tried with the wildcard namespace using *:tag but didn't investigate to know more about performance issues. > > Is there any best practices, hints or documentation pointers for such use case ? > > > > Cheers, > > -- > Guillaume Mella - Ingénieur CNRS > OSUG UMS832 : http://www.osug.fr <http://www.osug.fr/> - JMMC : http://www.jmmc.fr/~mellag <http://www.jmmc.fr/~mellag> > OSUG-D, 122 rue de la piscine, 38 400 Saint Martin d’Hères, France > ☎ +33 (0)4 76 63 58 22 > _______________________________________________ > Exist-open mailing list > Exi...@li... <mailto:Exi...@li...> > https://lists.sourceforge.net/lists/listinfo/exist-open <https://lists.sourceforge.net/lists/listinfo/exist-open> > _______________________________________________ > Exist-open mailing list > Exi...@li... > https://lists.sourceforge.net/lists/listinfo/exist-open |