ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> perl-xml
perl-xml
Re: libxml and (X)HTML documents
by Aaron Straup Cope other posts by this author
Jul 11 2002 2:08PM messages near this date
view in the new Beta List Site
Re: libxml and (X)HTML documents | Re: libxml and (X)HTML documents
On Thu, 11 Jul 2002, Eric Bohlman wrote:

>  7/11/02 7:49:30 AM, Aaron Straup Cope <asc@[...].net> wrote:
> 
>  >The problem is that if I don't parse the string-ified $dom object again as
>  >an HTML string, the stylesheet is unable to locate anything in the source
>  >document via XPath expressions -- stuff like : "/html/body/div[@id=$id]"
> 
>  I'm guessing that your problem has to do with namespaces in the source document; is it pos
sible that
>  the initial parsing of the source is leaving <html>, <body>, and <div> in the xhtml namesp
ace, but
>  your stylesheet doesn't know about that, so it's looking for, e.g. an <html> element in no
 namespace?

I'm not sure.

If I just declare "xmlns=http://foo.com", which has always been my
understanding was for default namespaces in XSL [1] ...

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

....the following error is printed to STDERR all over the place...

Prefix must not be undef in get_uri(). The emtpy prefix must be '' at
/usr/local/lib/perl5/site_perl/5.005/XML/NamespaceSupport.pm line 194.

If I declare...

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

....the new file contains the truly weird...

<?xml version='1.0' encoding='ISO-8859-1'?> 
<html xmlns:xhtml='http://www.w3.org/1999/html' xhtml:xmlns='http://www.w3.org/1999/html'> 

I don't have time to look right now, but I will try digging through
XML::NamespaceSupport later today to see if the problem lies there.

If I use same code from the SYNOPSIS for XML::LibXSLT, specify the xmlns
as either "xmlns=" or "xmlns:html=" and use the parse_file method, the
XPath queries continue to fail. If I switch to the "parse_html_file"
method, everything is honky-dorry.

[1] http://www.dpawson.co.uk/xsl/sect2/N5536.html#d163e387




_______________________________________________
Perl-XML mailing list
Perl-XML@[...].com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Thread:
Aaron Straup Cope
Eric Bohlman
Aaron Straup Cope
Robin Berjon

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved