Re: [xsl] Select name of XSD targetNamespace attribute

Subject: Re: [xsl] Select name of XSD targetNamespace attribute
From: "Abel Braaksma (Exselt)" <abel@xxxxxxxxxx>
Date: Fri, 28 Mar 2014 16:53:24 +0100
Hi Philipp,

xmlns:foo is a namespace declaration, not an attribute (and they have
very different semantics). You can find the namespaces available on an
element by using fn:in-scope-prefixes for the prefix (it will return all
prefixes, including 'foo') and fn:namespace-uri-for-prefix() on those
prefixes to find the namespace uri (the value of xmlns:prefix) belonging
to such prefix.

These functions are available in XPath 2.0 and 3.0. I am not sure
whether you can get the same information using XPath 1.0 (you didn't
specify what language you used, so I assumed 2.0).

Cheers,

Abel Braaksma
Exselt XSLT 3.0 processor
http://exselt.net


On 28-3-2014 16:44, Philipp Kursawe wrote:
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema targetNamespace="http://www.foo.com/test";
> xmlns:foo="http://www.foo.com/text";
> xmlns:xs="http://www.w3.org/2001/XMLSchema"; version="0.1.1.0">
> </xs:schema>
>
> I want to find out the name of the attribute that describes the
> targetNamespace ("xmlns:foo") or even better "foo"
>
> Thanks!

Current Thread