xsl-list
[Top] [All Lists]

RE: XHTML + XSL -> HTML problem

2004-05-24 06:15:05
Hi,

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

There's a SEMICOLON before the GREATHER-THAN SIGN, that makes your XSLT 
stylesheet ill-formed XML.

    <xsl:output method="text"/>

Your question subject says you want to generate HTML, but here you're using 
text output method. It should be html if you want to generate HTML.
 
   <xsl:template match="xhtml:title">

        <xsl:text>title: </xsl:text>
        <xsl:value-of select="."/>
        <xsl:text>&#10;</xsl:text>
    </xsl:template>

    <xsl:template match="p">

This will not match your source because in your source the p elements are in 
XHTML namespace.

        <xsl:text>paragraph "</xsl:text>
        <xsl:value-of select="@name"/>
        <xsl:text>": </xsl:text>
        <xsl:value-of select="."/>
        <xsl:text>&#10;</xsl:text>
    </xsl:template
</xsl:stylesheet>

I want to parse it and get the result as 
a HTML page.

Then you need to generate the html etc. elements in one of your templates.

I parse it via msxsl parser, but I get this error

D:\deepak\buildProcess_2\_tools>msxsl test.xhtml
test.xsl -o test.html

Error occurred while parsing document.

Code:   0xc00ce50a
URL:   
file:///D:/deepak/buildProcess_2/_tools/test.xhtml
Line:   2
Column: 70
The character '>' was expected.

Parser reports the well-formedness errors in your stylesheet.
 
Also how and where should I include the statement
manually inside the
xhtml file to indicate to parse via the xsl file.

In xml files we include the statement 
<?xml-stylesheet type="text/xsl" href="bcel-fb8.xsl"?>

Is parsing a XHTML via xsl a similar process?

Just serve the XHTML document using MIME-type "application/xhtml+xml" or e.g. 
"text/xml" and the browsers will process it as an XML document-if they support 
XML and XSLT.

Cheers,

Jarno


<Prev in Thread] Current Thread [Next in Thread>