Anthony --
This error frequently occurs when you are using an XML parser that does
not support namespaces. However, I'm assuming that you're using the
defaults that come with XalanJ and using the Xerces XML parser. If that
is the case, I'd have a look at what is actually coming in on your
xslLocation.openStream(). The diagnostic indicates the error is on line
1, column 7 which would be right smack in the middle of the
xsl:stylesheet element name, which does not make sense.
I suspect that your stream is returning a value other than the XSLT and
that this problem has nothing to do with the version upgrade.
Gary
Anthony Ikeda wrote:
>
> Using version 2.0.1, my xsl transformer worked fine, but when I upgraded to
> version 2.1, I get the following error:
>
> SystemId Unknown; Line 1; Column 7; Wed Jun 13 16:41:14 GMT+10:00 2001:
> TransformerConfigurationException: stylesheet requires attribute: version;
> Missing or incorrect XSLT Namespace.
>
> All my stylesheets start with:
>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
>
> And my transformer follows the following syntax:
>
> try{
> xmlSource = new StreamSource(strrdXml);
> xslSource = new StreamSource(xslLocation.openStream());
>
> TransformerFactory tFactory = TransformerFactory.newInstance();
> tFactory.setURIResolver(sur);
>
> transformer = tFactory.newTransformer(xslSource);
>
> if(parameters!=null){
> for(int i=0;i<parameters.length;i++){
> String pair = parameters[i];
> String parmName = pair.substring(0,pair.indexOf("="));
> String parmValue = pair.substring(pair.indexOf("=")+1,pair.length());
> transformer.setParameter(parmName,parmValue);
> }
> }
>
> transformer.transform(xmlSource, new StreamResult(out));
> } catch(TransformerConfigurationException te){
> DebugListener.printOut("TransformerConfigurationException:
> "+te.getMessageAndLocation());
> } catch(Exception e){
> DebugListener.printOut("XslProcessor: "+e);
> }
>
> I can't seem to locate any info on why this is happening, as Line 1 column 7
> is the character 'y' in stylesheet.
>
> Anyone able to help me on this one?
>
> Cheers,
> Anthony Ikeda
> Web Application Developer,
> Proxima Technology Pty. Ltd.
>
> North Sydney
> New South Wales,
> Australia 2060
> Office: (612) 9458 1718
> Mobile: 041 624 5143