<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Andrew Welch schrieb:
<blockquote
cite="mid74a894af0708150643v5284a62bn9fcbafc44f544ba4@mail.gmail.com"
type="cite">
<pre wrap="">On 8/15/07, Uwe Küssner <a class="moz-txt-link-rfc2396E" href="mailto:uwekuessner@web.de"><uwekuessner@web.de></a> wrote:
</pre>
<blockquote type="cite">
<pre wrap="">hello,
a short question, i hope somebody can help.
Let's say we have a XML documents like this:
<ele xmlns:a="aa" xmlns:b="bb" name="foo" a:name="bar"
b:name="foobar" b:x="y" />
The namespace names and attributes are not known before runtime, during
runtime of a xquery script we have two variables of type string, for
example:
$namespace := "bb"
$attribute :="name"
here is the question: how can we extract the value of the attribute
named $attribute with namespace name $namespace?
In the example the value of "b:name", i.e. "foobar".
</pre>
</blockquote>
<pre wrap=""><!---->
How about:
@*[name() eq concat($namespace,':',$attribute)]/data(.)
</pre>
</blockquote>
<br>
almost, the problem with your solution is that $namespace is not
prefix "b" itself , but the namespace name (uri) ("bb"). Is it
possible to get the prefix for a given namespace name ?<br>
</body>
</html>