[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
Hi Dwight,
At 04:20 PM 4/13/01, you wrote:
If that's what it is, yup.
I see two problems here.
One is that, if this is really your input:
you'll have problems because it shouldn't parse. One requirement for well-formed XML is that the instance have a root element node (often called a 'document element' in XSLT to avoid confusing it with the root node of the XPath tree, which is its parent). That is,
would be well-formed (albeit not valid to XHTML). What you have would be a well-formed 'external parsed entity' except those critters can't have DOCTYPE declarations.
So your parser should be throwing out your input file as not well-formed.
If it isn't, you get the second problem. Your stylesheet:
This root node template selects element children of the root (select="*"), but your document has no element children of the root (just a text node containing the string 'Test').
Try it with this input:
<html><body>Test</body></html>
and see what happens.
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Re: [xsl] Transforming XHTML possible?
Subject: Re: [xsl] Transforming XHTML possible? From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> Date: Fri, 13 Apr 2001 11:55:36 +0100 |
Hi Dwight,
At 04:20 PM 4/13/01, you wrote:
Is it possible to transform XHTML ?
If that's what it is, yup.
I have created what I think is a most basic example. The XHTML is by the standard. The style sheet should merely "copy" the XHTML from input to output. It looks to me like the xPath queries are not working. I'm using MSXML3. What am I missing ? Why doesn't this simple example work ? Are my copy templates missing something ?
Dwight Funk POWERWAY, Inc.
I see two problems here.
One is that, if this is really your input:
---------------TEST.XML--------------------------------------------------- <?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">
Test ---------------TEST.XML---------------------------------------------------
you'll have problems because it shouldn't parse. One requirement for well-formed XML is that the instance have a root element node (often called a 'document element' in XSLT to avoid confusing it with the root node of the XPath tree, which is its parent). That 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"> <test>Test</test>
would be well-formed (albeit not valid to XHTML). What you have would be a well-formed 'external parsed entity' except those critters can't have DOCTYPE declarations.
So your parser should be throwing out your input file as not well-formed.
If it isn't, you get the second problem. Your stylesheet:
---------------TEST.XSL--------------------------------------------------- <?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" encoding="UTF-8"/>
<!-- Match the root node --> <xsl:template match="/"> <xsl:apply-templates select="*"/> </xsl:template> ...
This root node template selects element children of the root (select="*"), but your document has no element children of the root (just a text node containing the string 'Test').
Try it with this input:
<?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">
<html><body>Test</body></html>
and see what happens.
Good luck, Wendell
====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] select only first node, Ronald | Thread | Re: [xsl] Transforming XHTML possib, Wendell Piez |
RE: [xsl] select only first node, Ronald | Date | Re: [xsl] Transforming XHTML possib, Wendell Piez |
Month |