Hi,

I have encountered a problem when trying to include a stylesheet which 
has an XPath fragment in a URI.

I am working on a document management system and we have our own
namespace, 
URL and URL handler. A stylesheet is wrapped up in some element as
follows

<some-tag>
   <xsl:stylesheet>
     ...
   </xsl:stylesheet>
</some-tag>

To import the stylesheet I would write:

<xsl:include href="cqr:////<some name to the content which contains the
XSL>#some-tag/* %5B
namespace-uri()='http://www.w3.org/1999/XSL/Transform' and
local-name()='stylesheet' %5D"/>

where %5B and %5D are [ and ] respectively.

This doesn't work. The templates defined in the imported template aren't
imported. Looking
at the Xalan code I noticed that the following method defined
org.apache.xalan.processor.StyleSheetHandler
sets the variable m_shouldProcess to false because my base identifier
has a # in it and therefore
the stylesheet doesn't get imported.

void pushBaseIndentifier(String baseID)
  {
    if (null != baseID)
    {
      int posOfHash = baseID.indexOf('#');

      if (posOfHash > -1)
      {
        m_fragmentIDString = baseID.substring(posOfHash + 1);
        m_shouldProcess = false;
      }
      else {
        m_shouldProcess = true;
      }
    }
    else
      m_shouldProcess = true;

    m_baseIdentifiers.push(baseID);
  }

So here's my question: what is this method doing? i.e. what sort of base
identifiers is this check
looking for?

Also, pushBaseIndentifier is misspelt. 

Additional points to consider:
URL handler with XPath works OK. Grabs the right blob of XML elements
i.e. a stream containing an XML document which is
a stylesheet.
Here's weird one. The included stylesheet contained a template which the
importing stylesheet called. This template wasn't
obviously being called (trace writes verified this), but no error was
raised. That is, no-template-with-name-was-found type 
error was raised. Removing this include statement or placing it at the
end of the stylesheet and it complained that it couldn't
find the template.

S.

Reply via email to