Hi,
I've got a little bit of a problem when dealing with namespaces and XPath.
I'm trying very basic things, like showing all the nodes of one particular
namespace. Here is my XPath statement:
//*[local-name() = 'buch' and namespace-uri() =
'http://www.example.com/buecher']
Unfortunately this doesn't work. I have found several ways to solve this
with XSLT, but I need the pure XPath statement.
My XML file looks like this:
<?xml version="1.0"?>
<!-- Dateiname: Sammlung.xml -->
<SAMMLUNG
xmlns:buch="htt p://www.example.com/buecher"
xmlns:cd="http://www.example.com/cds">
<buch:ARTIKEL Status="vorhand en">
<buch:TITEL>T he Adventures of Huckleberry Finn</buch:TITEL>
<buch:AUTOR>Mar k Twain</buch:AUTOR>
<buch:PREIS>12. 75</buch:PREIS>
</buch:ARTIKEL>
<cd:ARTIKEL>
<cd:TITEL>Violi nkonzert D-Dur</cd:TITEL>
<cd:KOMPONIST>B eethoven</cd:KOMPONIST>
<cd:PREIS>14.95 </cd:PREIS>
</cd:ARTIKEL>
</SAMMLUNG>
Could anyone please give me a hint how to solve this problem?
Thanks,
Stefan
I've got a little bit of a problem when dealing with namespaces and XPath.
I'm trying very basic things, like showing all the nodes of one particular
namespace. Here is my XPath statement:
//*[local-name() = 'buch' and namespace-uri() =
'http://www.example.com/buecher']
Unfortunately this doesn't work. I have found several ways to solve this
with XSLT, but I need the pure XPath statement.
My XML file looks like this:
<?xml version="1.0"?>
<!-- Dateiname: Sammlung.xml -->
<SAMMLUNG
xmlns:buch="htt p://www.example.com/buecher"
xmlns:cd="http://www.example.com/cds">
<buch:ARTIKEL Status="vorhand en">
<buch:TITEL>T he Adventures of Huckleberry Finn</buch:TITEL>
<buch:AUTOR>Mar k Twain</buch:AUTOR>
<buch:PREIS>12. 75</buch:PREIS>
</buch:ARTIKEL>
<cd:ARTIKEL>
<cd:TITEL>Violi nkonzert D-Dur</cd:TITEL>
<cd:KOMPONIST>B eethoven</cd:KOMPONIST>
<cd:PREIS>14.95 </cd:PREIS>
</cd:ARTIKEL>
</SAMMLUNG>
Could anyone please give me a hint how to solve this problem?
Thanks,
Stefan
Comment