Menu

An incovenient warning about xml declaration

Help
2010-09-02
2012-12-07
  • Donald Eddy

    Donald Eddy - 2010-09-02

    First, let me say that having tried many XML editors, XML Copy seems to be the best of the bunch. So far, the only irritant I have encountered is that when loading an XSLT file,  an xml declaration that is part of the boiler plate of  an xhtml page far down in the document is flagged with warning that it is not the first thing in the "entity".  The file itself has, as its first line, a valid xml declaration. It would seem that once the initial xml declaration for the file is found, that any subsequent such declaration would be ignored.
    I have gone around by removing the xml declaration, and using  HTML 4.01.

     
  • gnschmidt

    gnschmidt - 2010-09-02

    Hi dleddy, I'm very glad you're finding xmlce useful!

    To create XML declarations in your output from XSL, you need to use the relevant attributes of the

    xsl:output
    

    element.

    For example, to create an XHTML 1.0 document, you could use:

    <xsl:output method="xml" encoding="UTF-8" indent="yes" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" doctype-system="http://www.w3.org/1999/xhtml"/>
    

    There's also an attribute that enables you to suppress the declaration (

    omit-xml-declaration="yes"
    

    . I think the default is to create the XML declaration.

    Hope that helps,
    Gerald

     
  • Donald Eddy

    Donald Eddy - 2010-09-02

    Thanks for the input. As you might guess, I am totally new at this XML stuff, and am learning piece by piece.  I had thought the literal text output would be the easiest way to go, but perhaps the xsl:output element also lets the xslt processor know what is going on in addition to letting the processor insert the declarations..  I'm also looking at the xsl:text element to understand its uses.

     

Log in to post a comment.