Dymond
Dymond

Reputation: 2277

ad doctype an validate XSL file

I dont seem to get my XSL file validate when i enter the Doctype.

Any ideas ??

<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

    <xsl:template match="/">

    <!--Xpath, presenterar hela dokumentet, även prologen-->
        <html>
            <link rel="stylesheet" type="text/css" href="style.css"/>  <!---Hämtar extern CSS-->
            <body>
            <div id ="wrap">
            <div id ="title">
                <xsl:value-of select="//language" /> ordlista</div> <!--Hämtar värdet från nodden language-->
                <div id="author">Författare: <xsl:value-of select="//lastname" />, 
                <xsl:value-of select="//firstname" /></div> <!--Värden från för och efternamn-->
                <p  class="word">Ord:</p>
                <!--for-each-loop för varje word-instans-->
                <xsl:for-each select="//word">
                    <!--sorterar listan. Punkten är XPath's this-->
                    <xsl:sort select="."/>
                    <p><xsl:value-of select="." /></p> <!--Hämtar värderna från word-->
                </xsl:for-each>
                </div>
            </body>
        </html>
    </xsl:template>
</xsl:stylesheet>

Upvotes: 0

Views: 141

Answers (1)

Lumi
Lumi

Reputation: 15264

XSLT doesn't have and doesn't need a DOCTYPE. Guess you're confusing the DOCTYPE with the XML declaration, which you have as follows:

<?xml version="1.0" encoding="iso-8859-1"?>

There's nothing wrong with this line. Just make sure that the encoding you specify actually matches the file encoding. Can't see how a single-byte full-range encoding (ASCII only half-range) would cause the parsing to fail, though.

If you want to generate a DOCTYPE from your XSL transformation for your result document, then read this article from 2002.

Upvotes: 1

Related Questions