Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 16th, 2007, 11:49 AM
Registered User
 
Join Date: May 2007
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default xslt -> xhtml validation

hi,i have written a stylesheet to transform a xml to xhtml.And i need to validate the xhtml produced.
I tried validating my code,but i get error.

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


<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"  
xmlns="http://www.w3.org/1999/xhtml" >    


<xsl:output method="xml" indent="yes"
     doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
    doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" />

    <xsl:template match="/">
        <html>
            <body>
            </body>
        </html>
    </xsl:template>

</xsl:stylesheet>
i tried to validate it at http://validator.w3.org/ by copying and pastign the code.it doesn't seem to work. there seems to be some major mistake i am making.hope someone can rectify and corect my errors.would apreciate it.thanx alot

 
Old May 16th, 2007, 12:10 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

If your XHTML is invalid then we need to see the XHTML and the error messages, how you generated the XHTML is irrelevant.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old May 16th, 2007, 10:44 PM
Registered User
 
Join Date: May 2007
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I was writing a xslt to transform a xml to xhtml.
the main outline of the code is:

<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC
    "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">



<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="http://www.w3.org/1999/xhtml" >




    <xsl:template match="/">
        <html>
            <body>
            </body>
        </html>
    </xsl:template>

</xsl:stylesheet>



i tried to validate it at http://validator.w3.org/, but it fails.

the errors i get are:
Line 8 column 24: there is no attribute "version"
Line 8 column 40: there is no attribute "xmlns:xsl"
Line 9 column 6: there is no attribute "xmlns".
Line 9 column 37: element "xsl:stylesheet" undefined.
Line 14 column 24: there is no attribute "match".
Line 14 column 27: element "xsl:template" undefined.
Line 16 column 17: document type does not allow element "body" here.
Line 18 column 14: end tag for "html" which is not finished.
Line 21 column 17: no document element.


I had also refered to the site http://www.objectsbydesign.com/projects/xslt/xhtml.html whose tutorial is based on a reference to XSLT Programmer's Reference page. 250-261

I really need some one to guide and correct my errors.I need to get it to be a valid xhtml.thanx alot










 
Old May 17th, 2007, 02:54 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

The XHTML validator is designed to validate an XHTML file: that is, the output file produced when you run your stylesheet. It is not designed to validate the stylesheet itself, which is what you appear to be doing.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference





Similar Threads
Thread Thread Starter Forum Replies Last Post
XHTML Validation nairaby HTML Code Clinic 2 August 11th, 2007 02:45 AM
W3C XHTML Validation on ASP:Label control rit01 ASP.NET 2.0 Basics 6 June 26th, 2006 12:30 PM
w3 HTML (XHTML) validation crmpicco HTML Code Clinic 6 June 7th, 2006 07:33 AM
Forms with XML > XSLT > XHTML kwilliams XSLT 0 October 27th, 2005 09:52 AM
XHTML validation - passing parameter mattastic HTML Code Clinic 1 December 9th, 2004 10:18 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.