Re: [xml] Possible bug in 2.7.2

On Thu, Oct 30, 2008 at 12:43:16PM -0700, Dave Connet wrote:
In generating some xslt, I think I've come across a bug...
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="test.xsl"?>
<Root PathName="C:\Test Dir\">
<Note id="Id1"/>

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="";
<xsl:output method="html" encoding="UTF-8"/>
<xsl:template match="/">
 <xsl:apply-templates />
<xsl:template match="Root">
   <xsl:value-of select="/Root/@PathName"/><br/>tes
   <xsl:apply-templates select="Note"/>
<xsl:template match="Note">
  <xsl:attribute name="width">415</xsl:attribute>
  <xsl:attribute name="height">10</xsl:attribute>
  <xsl:attribute name="src"><xsl:value-of
 <xsl:value-of select="@id"/><br/>

Both xalan and IE (browser,v7) produce the same results. xsltproc
Using xalan:
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<BODY>C:\Test Dir\<br>tes
   <img width="415" height="10" src="C:\Test

Using xsltproc:
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<BODY>C:\Test Dir\<br>tes
   <img width="415" height="10"

A posting on the xslt list mentioned that this could probably be
considered a bug in libxml2 - and pointed to htmlAttrDumpOutput in

  libxml2 knows that the src attribute of img tag is an URI-Reference
and applies the URI-Reference escaping algorithm.
  Your problem is that what you are giving as src attribute value is
a windows path and not an URI-Reference, that's the core of your problem
a windows path should not be put as an URI reference in an HTML page.

I'm not sure what the proper fix should be - I know in my case, simply
adding '\' and ' ' to the excluded chars would fix the above. I don't
know what other effects that might have... (and my generating code can
easily change '\' to '/' before generating the xml, needing only the
space added to the excluded chars then)

  use a file:/// based URI to express your path


Daniel Veillard      | libxml Gnome XML XSLT toolkit
daniel veillard com  | Rpmfind RPM search engine | virtualization library

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