I am trying to add support for XSL to the Brazil technology using
Xalan. There was an exisiting example suggesting a use with Brazil,
which works very well. I need the ability to pass the parsed document
down the handler/template/filter chain and perform additional processing
on the text or I might pre process before sending to Xalan to generate
XML and or replace macros etc. I have created a tag called
<applyxsl xsl=birds.xsl .....>
<?xml version="1.0" encoding="UTF-8"?>
<Class>
<Order Name="TINAMIFORMES">
<Family Name="TINAMIDAE">
<Species Scientific_Name="Tinamus major"> Great
Tinamou.</Species>
<Species Scientific_Name="Nothocercus">Highland
Tinamou.</Species>
<Species Scientific_Name="Crypturellus soui">Little
Tinamou.</Species>
..............
</applyxsl>
When I read the xml file from a file using FileInptuStream everything
works great when I provide the input using a String and StringReader I
get the following exception. I am using the supplied birds.xsl example.
Here is the code segment that fails....
StringReader xmlStream = new StringReader(script);
//FileInputStream xmlStream = new FileInputStream("doc/birds.xml");
System.out.println( script );
ByteArrayOutputStream output = new ByteArrayOutputStream();
transformer.transform(new StreamSource(xmlStream), new
StreamResult("x.out"));
The exception follows:
Thanks for your time.
Rinaldo
LOG: 5 8087-127.0.0.1-0: xsl.: javax.xml.transform.TransformerException:
org.xml.sax.SAXParseE
xception: The processing instruction target matching "[xX][mM][lL]" is
not allowed.
javax.xml.transform.TransformerException: org.xml.sax.SAXParseException:
The processing instru
ction target matching "[xX][mM][lL]" is not allowed.
at
org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:680)
at
org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1079)
at
org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1057)
at
ApplyXslServerTemplate.tag_applyxsl(ApplyXslServerTemplate.java:139)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:42)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:2
8)
at java.lang.reflect.Method.invoke(Method.java:313)
at
sunlabs.brazil.template.TemplateRunner.process(TemplateRunner.java:317)
at
sunlabs.brazil.template.TemplateRunner.process(TemplateRunner.java:262)
at
sunlabs.brazil.template.TemplateHandler.respond(TemplateHandler.java:185)
at sunlabs.brazil.server.Connection.run(Connection.java:70)
at java.lang.Thread.run(Thread.java:539)
Caused by: org.xml.sax.SAXParseException: The processing instruction
target matching "[xX][mM]
[lL]" is not allowed.
at
org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1171)
at
org.apache.xml.dtm.ref.DTMManagerDefault.getDTM(DTMManagerDefault.java:348)
at
org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:624)
... 12 more
---------
org.xml.sax.SAXParseException: The processing instruction target
matching "[xX][mM][lL]" is no
t allowed.
at
org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1171)
at
org.apache.xml.dtm.ref.DTMManagerDefault.getDTM(DTMManagerDefault.java:348)
at
org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:624)
at
org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1079)
at
org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1057)
at
ApplyXslServerTemplate.tag_applyxsl(ApplyXslServerTemplate.java:139)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:42)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:2
8)
at java.lang.reflect.Method.invoke(Method.java:313)
at
sunlabs.brazil.template.TemplateRunner.process(TemplateRunner.java:317)
at
sunlabs.brazil.template.TemplateRunner.process(TemplateRunner.java:262)
at
sunlabs.brazil.template.TemplateHandler.respond(TemplateHandler.java:185)
at sunlabs.brazil.server.Connection.run(Connection.java:70)
at java.lang.Thread.run(Thread.java:539)
LOG: 4 8087-127.0.0.1-0: request done
LOG: 3 8087-127.0.0.1-0: Error: 408 Request Time-out: Read timed out
LOG: 4 8087-127.0.0.1-0: socket close