You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Christopher Hull <ch...@mediagate.com> on 2001/03/02 20:32:23 UTC

Transformers and namespace issues

Ok, this brings me to what appears to be my last problem in my effort to 
upgrade to Xalan 2.  I may be doing something funny with name spaces
in my XSL, and now all of a sudden it appears as though my XSL 
extensions can no longer be found by Xalan's new transformers.

Here is the header from a stylesheet that establishes a 
"StringFunctions" namespace and includes these functions.
  -----
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	version="1.0"
xmlns:StringFunctions="C:/qs/tomcat/webapps/qsdocs/common/en_US/html/StringFunctions.xsl"
	extension-element-prefixes="StringFunctions">
	
  -----
Later in the XSL a function is called like this...

</xsl:attribute><xsl:value-of 
select="StringFunctions:first15Chars(string($textLabel))"/>
  -----

When a transformer runs this, it throws an exception saying that it 
can't find extension call first15Chars (I'll try to get the exact 
exception if this is not enough information).

What am I doing wrong?  What has changed with this regard from Xalan 
1.x?  Do I need to tell transformers to be namespace aware somehow?

Thanks again;
-Chris





LotusXSL_Team/CAM/Lotus%LOTUS@lotus.com wrote:

 > Ah-ha! I had forgotten that you changed it to parse the xsl 
stylesheet into
 > a DOM.  In that case, the sample DOM2DOM.java is slightly misleading: 
when
 > parsing xsl documents, you have to call:
 > documentBuilderFactory.setNamespaceAware(true);
 > before parsing any xsl documents -  which is not necessarily required to
 > parse the xml document you want to transform.  You should be able to add
 > this to your example before parsing the xsl doc and it should work.
 >
 > I've updated xml-xalan\java\samples\DOM2DOM\DOM2DOM.java to parse 
both the
 > xsl and xml into DOMs, and added the setNamespaceAware call, so this 
should
 > be clearer in the future.
 >
 > - Shane



-- 

Christopher Hull
Engineering Group Manager, Senior Software Architect
Mediagate Inc.
iPost Card     http://web.mediagate.com/chris.hull
iPost Voice    408 261 7201
email          chris.hull@mediagate.com