Problem with XSL transformation when changing from DTD to XSD

Discussion in 'XML' started by Pascal, Jan 14, 2007.

  1. Pascal

    Pascal Guest

    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
    Pascal, Jan 14, 2007
    #1
    1. Advertising

  2. * Pascal wrote in comp.text.xml:
    >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


    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.
    --
    Björn Höhrmann · mailto: · 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/
    Bjoern Hoehrmann, Jan 14, 2007
    #2
    1. Advertising

  3. Pascal

    Pascal Guest

    "Bjoern Hoehrmann" <> a écrit dans le message de news:
    ...


    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
    Pascal, Jan 14, 2007
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Matt
    Replies:
    3
    Views:
    37,199
    MKNDK
    Sep 11, 2008
  2. Replies:
    1
    Views:
    3,583
    A. Bolmarcich
    May 27, 2005
  3. Replies:
    0
    Views:
    519
  4. Michael
    Replies:
    1
    Views:
    446
    Martin Honnen
    Aug 29, 2008
  5. Ali Asghar
    Replies:
    1
    Views:
    115
    Lasse Reichstein Nielsen
    Aug 6, 2003
Loading...

Share This Page