XSLT and the DTD callout in the source XML file

Discussion in 'XML' started by jopaki@yahoo.com, Mar 10, 2005.

  1. Guest

    Hello all,

    I am relatively new to XSLT. I am attempting to transform XML and
    everyting is cool until I introduce these top lines in the source XML
    (really XHTML):

    ---------
    <?xml version="1.0" encoding="UTF-8"?>

    <!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    -----------

    as opposed to just:

    ----------
    <html>
    ....
    ----------

    It seems that the combination of the DTD reference and the html tag
    attributes affect the output. The output with the DTD callout blindly
    outputs all element values within the source seemingly regardless of
    the XSL file. And when they are out I get the desired result xml
    structure. I want to keep the DTD callout (and xmlns attrib) because
    1) the source is XHTML and 2) this DTD defines &nbsp; and the like.

    What is going on?

    Any input would warrant a free ice cream payable from my account.

    I am using Java xalan v2.6.2

    tia!


    The Logic Lab Consulting
    , Mar 10, 2005
    #1
    1. Advertising

  2. This is a faq (especially on xsl-list which is probably better suited to
    xsl qns than c.t.x).

    The XHTML DTD defaults a namespace declaration for xhtml so the elements
    are no longer in no-namespace and are in the xhtml namespace, this means
    that <xsl:template match="html"> no longer matches, you need
    <xsl:template match="h:html"> and add
    xmlns:h="http://www.w3.org/1999/xhtml" to your xsl:stylesheet.
    Simmilarly prefix every other element name in XPath expressions and
    match patterns.

    David
    David Carlisle, Mar 10, 2005
    #2
    1. Advertising

  3. Guest

    David, Thank you so much! - jon
    , Mar 10, 2005
    #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. Stylus Studio
    Replies:
    0
    Views:
    621
    Stylus Studio
    Aug 3, 2004
  2. Duane Morin
    Replies:
    1
    Views:
    826
    Patrick TJ McPhee
    Dec 11, 2003
  3. test
    Replies:
    2
    Views:
    1,975
    Oliver Wong
    Jul 28, 2006
  4. Replies:
    2
    Views:
    641
    unomystEz
    Sep 2, 2006
  5. oo@@oo

    what is a callout structure ?

    oo@@oo, Aug 4, 2006, in forum: C Programming
    Replies:
    1
    Views:
    394
    Christopher Benson-Manica
    Aug 4, 2006
Loading...

Share This Page