Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > Problem with XSL transformation when changing from DTD to XSD

Reply
Thread Tools

Problem with XSL transformation when changing from DTD to XSD

 
 
Pascal
Guest
Posts: n/a
 
      01-14-2007
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...log/pireps.xml
http://perso.numericable.fr/~ppascal...pireps.dtd.txt
copy of original file pireps.dtd

not working :
http://perso.numericable.fr/~ppascal...og/pireps2.xml
http://perso.numericable.fr/~ppascal...log/pireps.xsd

common stylesheet:
http://perso.numericable.fr/~ppascal...log/xform2.xsl




 
Reply With Quote
 
 
 
 
Bjoern Hoehrmann
Guest
Posts: n/a
 
      01-14-2007
* Pascal wrote in comp.text.xml:
>working:
>http://perso.numericable.fr/~ppascal...log/pireps.xml
>http://perso.numericable.fr/~ppascal...pireps.dtd.txt
>copy of original file pireps.dtd
>
>not working :
>http://perso.numericable.fr/~ppascal...og/pireps2.xml
>http://perso.numericable.fr/~ppascal...log/pireps.xsd


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='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.
--
Björn Höhrmann · (E-Mail Removed) · http://bjoern.hoehrmann.de
Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de
68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/
 
Reply With Quote
 
 
 
 
Pascal
Guest
Posts: n/a
 
      01-14-2007

"Bjoern Hoehrmann" <(E-Mail Removed)> a écrit dans le message de news:
9u5lq2ddm555uc4mn34qvep5v1ngpfme6h@h...hoe hrmann.de...


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


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
convert XML to XSD? or DTD to XSD? Matt XML 3 09-11-2008 12:40 PM
XSLT transformation tool working with id() function and XSD? Michael XML 1 08-29-2008 11:38 AM
Use output of XSL transformation as new XSL stylesheet barney.b@iname.com XML 0 01-16-2006 02:29 PM
XSL Question tp xsl:for-each and xsl:variable schaf@2wire.ch XML 1 05-27-2005 09:25 PM
XSL transformation and javascript inclusion problem of external .js files Ali Asghar Javascript 1 08-06-2003 06:27 PM



Advertisments