You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xalan.apache.org by Henry Zongaro <zo...@ca.ibm.com> on 2006/01/03 15:55:02 UTC

Re: Dynamically building a SAXSource for a transformer

Hi, Dave.

"Dave Brosius" <db...@mebigfatguy.com> wrote on 2005-12-29 08:12:20 AM:
>   public void startDocument() throws SAXException {
>    super.startDocument();
> 
>    AttributesImpl atts = new AttributesImpl();
>    atts.addAttribute("http://www.w3.org/1999/XSL/Transform", "version",
> "xsl:version", "number", "1.0");
>    super.startElement("http://www.w3.org/1999/XSL/Transform", 
"transform",
> "xsl:transform", atts);
> 
> however, doing this xalan yells at me:
> 
> javax.xml.transform.TransformerConfigurationException:
> javax.xml.transform.TransformerException:
> javax.xml.transform.TransformerException: "xsl:version" attribute is not
> allowed on the xsl:transform element!

     The version attribute should be in no namespace.  The same is true 
for all attributes defined by the XSLT Recommendation when they appear on 
elements that are in the XSLT namespace.  Those XSLT attributes that are 
permitted to appear on literal result elements, on the other hand, must be 
in the XSLT namespace when they appear on an LRE in order to have any 
effect.

     If you change your addAttribute method invocation to the following, I 
believe it should work.  Note that I've changed the type of the attribute 
to the type declared by the DTD fragment for XSLT stylesheets.[1]

atts.addAttribute("", "version", "version", "NMTOKEN", "1.0");

Thanks,

Henry
[1] http://www.w3.org/TR/xslt#dtd
------------------------------------------------------------------
Henry Zongaro      Xalan development
IBM SWS Toronto Lab   T/L 969-6044;  Phone +1 905 413-6044
mailto:zongaro@ca.ibm.com