Re: querying multiple params
Maurice Mengel <[email protected]>
| Newsgroups | gmane.comp.lang.perl.xml |
|---|---|
| Message-ID | <[email protected]> |
Hi, thanks for the feedback again! I coudn't install xacobeo so far with cygwin, but still trying. I found the error, however, while I prepared the example data for you! Just a stupid perl/xml thing. Perl starts to count at 0, XSLT/XPATH at 1, of course. So, I did get the right results, but I didn't notice.Anyways: thanks for the fast help! best Maurice ---------------------------------------------- Maurice Mengel Music Archive Ethnological Museum National Museums in Berlin http://www.ilkar.de --------------------------------------------- On Fri, Jul 24, 2009 at 8:01 AM, Petr Pajas <[email protected]> wrote: > 2009/7/24 Maurice Mengel <[email protected]>: > > Hi Petr, > > > > thanks for the quick answer! > > > > It is not that I didn't read these sentences, but I don't quite know what > to > > do with it. I tried a lot of other queries a long the way today and they > > worked as expected, e.g. > > //mpx:sammlungsobjekt[mpx:andereNr[@art = 'ID' and . = '$id'] and > > mpx:andereNr[@art ='DAT-Nr.' and . ]] > > > > Only the full one doesn't work: > > //mpx:sammlungsobjekt[mpx:andereNr[@art = 'ID' and . = '$id'] and > > mpx:andereNr[@art ='DAT-Nr.' and = '$tape_no']] > > > > > > That means only when I add the second variable, it doesn't work. That's > why > > I assumed, I don't need to take the namespace issue into consideration. > > Anyways, it would be somewhat counter intuitive if the 2nd criterion > breaks > > the namespace. At least, this is how it looks for me at the moment. > > > > I tried of course what you suggest. But I don't really get it either. I > > cannot find any example on the web easily. Special thanks therefore for > the > > faq. I forgot about it. I am not sure I understand XPathContext. Anyways, > > > > my $xpc = XML::LibXML::XPathContext->new; > > $xpc->registerNs('mpx', 'http://www.mpx.org/mpx'<http://www.mpx.org/mpx%27> > ); > > my $xpath ="//mpx:sammlungsobjekt[mpx:andereNr[\@art = 'ID' and . > = > > '$id'] and mpx:andereNr[\@art ='DAT-Nr.' and . = '$tape_no']]"; > > my @nodes = $xpc->findnodes($xpath, $root); > > > > gives me exactly the same result (with and without the 2nd variable). > > > > Are you sure it is the namespace? Seems hard to believe... > > Sorry, answering emails late at night was not a good idea. You are > right, if the namespaces were not registered, you would get an error. > > So hard to tell, post a sample XML file and the values of the > interpolated variables. > > -- Petr > _______________________________________________ Perl-XML mailing list [email protected] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs