Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re:still problems with XPath and namespaces...

From: "Stefan Franke" <stefan.franke@---.--.-->
To: NULL
Date: 1/3/2005 5:34:00 PM
Hi,
I'm still having troubles with XPath and namespaces.

The XML I'm using looks like this:

<SAMMLUNG
   xmlns:buch="http://www.example.com/buecher"
   xmlns:cd="http://www.example.com/cds">

   <buch:ARTIKEL Status="vorhanden">
      <buch:TITEL>The Marble Faun</buch:TITEL>
      <buch:AUTOR>Nathaniel Hawthorne</buch:AUTOR>
      <buch:PREIS>10.95</buch:PREIS>
   </buch:ARTIKEL>
   <cd:ARTIKEL>
      <cd:TITEL>Violinkonzerte 1, 2 und 3</cd:TITEL>
      <cd:KOMPONIST>Mozart</cd:KOMPONIST>
      <cd:PREIS>16.49</cd:PREIS>
   </cd:ARTIKEL>
</SAMMLUNG>


If I want to display e.g. all the CDs of Mozart, I would do something like 
this if I wouldn't have to deal with namespaces:

string(//*/TITEL[following-sibling::KOMPONIST='Mozart'])

My suggestion when dealing with namespaces would be something like this (but 
it doesn't work, as there is no TITEL-element anywhere, but I don't know how 
to get it in there):

string(//*[local-name()='ARTIKEL' and 
namespace-uri()='http://www.example.com/cds']/*[string(local-name()='KOMPONIST') 
= 'Mozart'])

Anyway, as I said before, that doesn't work. Could someone please help me 
with that?

Thanks,
Stefan 




transparent
Print
Mail
Digg
delicious
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent