[xslt] Bug in import with namespaces?



Hello,

I'm experiencing what I think is a bug in how namespaces are handled
with imported stylesheets

For example using the following text file:

<?xml version= "1.0"?>
<document xmlns="http://my/namespace";>
  <item>Success</item>
</document>

Given an outer stylesheet:

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

  <xsl:import href="inner.xsl"/>

  <!-- Root Node -->
  <xsl:template match="/">
    <xsl:apply-templates/>
  </xsl:template>
  
</xsl:stylesheet>

that imports an inner stylesheet:

<?xml version= "1.0"?>

<xsl:stylesheet version="1.0" 
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
  xmlns:my="http://my/namespace";
  exclude-result-prefixes="my">

  <xsl:template match="my:document">
    Big <xsl:apply-templates select="my:item"/>
  </xsl:template>
  
</xsl:stylesheet>


The template for matching my:document seems to work just fine, but
it's having problems with the select="my:item".  the current cvs
version of libxslt spits out

Error xpath.c:6570: Undefined namespace prefix
xmlXPathEval: evaluation failed

Looking at xpath.c it appears that the call to xmlXPathNsLookup() is
drawing a blank here.  Poking around in gdb, it looks like the
namespace is defined in the array ctxt->namespaces, but it doesn't
show up in the hash table ctxt->nsHash.  I tried to dig back through
the source code, but I got a bit lost :)


--Brent


-------------------------------------------------------------------------

"The programmer, like the poet, works only slightly removed from pure
 thought-stuff.  He builds his castles in the air, from air, creating
 by exertion of the imagination.  Few media of creation are so
 flexible, so easy to polish and rework, so readily capable of
 realizing grand conceptual structures."
                        -- Frederick Brooks, Jr., The Mythical Man Month




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