[xml] Possible bug in 2.7.2



In generating some xslt, I think I've come across a bug...
test.xml:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="test.xsl"?>
<Root PathName="C:\Test Dir\">
<Note id="Id1"/>
</Root>

test.xsl
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
version="1.0">
<xsl:output method="html" encoding="UTF-8"/>
<xsl:template match="/">
 <xsl:apply-templates />
</xsl:template>
<xsl:template match="Root">
 <HTML>
  <head><title>Header</title></head>
  <BODY>
   <xsl:value-of select="/Root/@PathName"/><br/>tes
   <xsl:apply-templates select="Note"/>
  </BODY>
 </HTML>
</xsl:template>
<xsl:template match="Note">
 <img>
  <xsl:attribute name="width">415</xsl:attribute>
  <xsl:attribute name="height">10</xsl:attribute>
  <xsl:attribute name="src"><xsl:value-of
select="/Root/@PathName"/>images/myImage.gif</xsl:attribute>
 </img>
 <xsl:value-of select="@id"/><br/>
</xsl:template>
</xsl:stylesheet>

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

Using xsltproc:
<HTML>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Header</title>
</head>
<BODY>C:\Test Dir\<br>tes
   <img width="415" height="10"
src="C:%5CTest%20Dir%5Cimages/myImage.gif">Id1<br>
</BODY>
</HTML>

A posting on the xslt list mentioned that this could probably be
considered a bug in libxml2 - and pointed to htmlAttrDumpOutput in
HTMLtree.c.
 
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)

Dave Connet



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