[xslt] parsing xml-files


I've got a question about the use of prefixes in an XML-file when parsing it
to an HTML-doc.
When I looked at the documentation in the W3 pages, it seemed that using a
namespace prefix is not obligated.  It even seems so that when you define a
namespace in a node, all childnodes use this namespace, unless you declare a
new one, or use a prefix for a node.  This means a xml like the following is
well formed:

<?xml version='1.0' encoding='utf-8'?>
<record xmlns="http://namespace_1/">
    <person xmlns="http://namespace_2/">

The nodes <record> en <data> should make use of namespace_1, the nodes
<person>, <name> and <firstname> should make use of namespace_2.  According
to what W3 says, this is a wellformed XML-doc.

My question is the following:
Howcome I'm unable to parse this document withoud adding prefixes (like the

<?xml version='1.0' encoding='utf-8'?>
<xsi:record xmlns="http://namespace_1/">
    <person pers:xmlns="http://namespace_2/">

The actual problem is that my XML-doc comes from the server looking like my
first example.  Is there any possibility using the libxml or libxslt
libraries to solve this problem.  Maybe there is a way of parsing this file,
or maybe I can automatically add these prefixes.  I'm just guessing.  Can
anybody help me with this please?


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]