[xslt] <html xmlns=.... > issue



ls,

I try to retrieve the title from an XHTML document using a
stylesheet.
Using xsltproc from libxslt-2.6.17 I get no result in case the opening
html-element contains a xmlns spec: 

  <html xmlns="http://www.w3.org/1999/xhtml";>

when I remove the xmlns declaration, the title is correctly printed.

I expected that in both cases the title should appear.

Can anyone explain what I'm doing wrong? 

Joost Helberg

Both stylesheet and example HTML file are below.

Stylesheet: 

<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="1.0">
 <xsl:template match="html/head/title"><xsl:value-of select="text()"/></xsl:template>
 <xsl:template match="text()"/>
</xsl:stylesheet>

XHTML file:

<?xml version="1.0" encoding="iso-8859-1"?>
<html xmlns="http://www.w3.org/1999/xhtml";>
<head>
  <title>the title</title>
</head>
<body>bla bla</body>
</html>


In case xmlns is mentioned, the title is not produced:

   $ xsltproc y.xsl y.html
   $

In case the xmlns attribute is removed (simple <html>), the title
appears: 

   $ xsltproc y.xsl y.html 
   <?xml version="1.0"?>
   the title
   $

Regards,

Joost Helberg
-- 
Joost Helberg
Snow B.V.        http://snow.nl Tel 0418-653333 Fax 0418-653666
Voorzitter VOSN  http://www.vosn.nl Tel 0418-653336 Fax 0418-653666


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]