Problem with XSL transformation when changing from DTD to XSD

P

Pascal

Hello,

I am beginner with XML. I have created a XML file with a DTD and a XSL
stylesheet in order to view my data in HTML.
It works.

Then I have tried to setup a XSD instead of DTD and add few type
constraints.
Then I am not any more able to see correct HTML output.

I checked with w3c validator, my XML and XSD files seem to be valid.

I do not understand what's wrong, maybe syntax error in XSL. I do not know
how to validate XSL file.
It seems that I cannot match the nodes.
I tried to include debug statements with child::*, ancestor::*,
descendant::* that told me XLS is able to find a node hierachy.

Thanks for help

Pascal

files are located :
working:
http://perso.numericable.fr/~ppascal/msfs/airstar/flightlog/pireps.xml
http://perso.numericable.fr/~ppascal/msfs/airstar/flightlog/pireps.dtd.txt
copy of original file pireps.dtd

not working :
http://perso.numericable.fr/~ppascal/msfs/airstar/flightlog/pireps2.xml
http://perso.numericable.fr/~ppascal/msfs/airstar/flightlog/pireps.xsd

common stylesheet:
http://perso.numericable.fr/~ppascal/msfs/airstar/flightlog/xform2.xsl
 
B

Bjoern Hoehrmann

* Pascal wrote in comp.text.xml:

The problem is the xmlns='...' attribute you added; in an XML document,
the names of elements and attributes have two parts, a namespace name
and a local name. In the original XML document you had e.g. an element

{ '', 'flightlog' }

Here the namespace name is '' and the local name 'flightlog'. With the
xmlns='' attribute you have changed the element name to

{ 'http://perso.numericable.fr/~ppascal/msfs/airstar/logbook',
'flightlog' }

However, the XSLT document is still looking for a { '', 'flightlog' }
element, which it does not find. To fix this, you have to either re-
move the xmlns attribute or change the XSLT document so its looking for
the right kind of element. For the latter you will have to add something
like

xmlns:p='http://perso.numericable.fr/~ppascal/msfs/airstar/logbook'

to the XSLT and then change 'flightlog' into 'p:flightlog', and do the
same for all other element types.
 
P

Pascal

"Bjoern Hoehrmann" <[email protected]> a écrit dans le message de
(e-mail address removed)...


Bjoern,

Many thanks, it works now. I wasted many hours on that problem.

I read about namespace, but I did not care of, because it was working on my
first trial without it.
Also I thought that it was for XML files and not for XSL. But now, I
understand that in order to access elements with XSL I must specify
namespace also.

This was very kind from you to help me.
Pascal
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,190
Members
46,736
Latest member
zacharyharris

Latest Threads

Top