<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:arial, helvetica, sans-serif;font-size:10pt"><DIV><FONT size=2>
<P>Hi All,</P>
<P>I am getting the following exception when trying to do simple transformation (newbie in JDOM XSLT) using either XSLTransformer/TrAX in JDOM:</P>
<P>&nbsp;</P>
<P><STRONG>javax.xml.transform.TransformerConfigurationException: java.io.EOFException: no more input</STRONG></P>
<P>at com.icl.saxon.PreparedStyleSheet.prepare(PreparedStyleSheet.java:121)</P>
<P>at com.icl.saxon.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:120)</P>
<P>at com.icl.saxon.TransformerFactoryImpl.newTransformer(TransformerFactoryImpl.java:72)</P>
<P>at standaloneClientRemoteInvestmentBean.JDOMTrAXPojoInvestmentBean.retrieveAreaZipcode(JDOMTrAXPojoInvestmentBean.java:68)</P>
<P>at standaloneClientRemoteInvestmentBean.JDOMTrAXPojoInvestmentBean.main(JDOMTrAXPojoInvestmentBean.java:37)</P>
<P>Caused by: java.io.EOFException: no more input</P>
<P>at com.icl.saxon.aelfred.XmlParser.popInput(XmlParser.java:4083)</P>
<P>at com.icl.saxon.aelfred.XmlParser.pushURL(XmlParser.java:3620)</P>
<P>at com.icl.saxon.aelfred.XmlParser.doParse(XmlParser.java:159)</P>
<P>at com.icl.saxon.aelfred.SAXDriver.parse(SAXDriver.java:320)</P>
<P>at com.icl.saxon.om.Builder.build(Builder.java:265)</P>
<P>at com.icl.saxon.PreparedStyleSheet.prepare(PreparedStyleSheet.java:111)</P>
<P>... 4 more</P>
<P>&nbsp;</P>
<P>Below is the stateStyleSheet:</P>
<P>&lt;?xml version="1.0" encoding="ISO-8859-1"?&gt;</P>
<P>&lt;xsl:stylesheet version="1.0"</P>
<P>xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt;</P>
<P></P>
<P>&lt;xsl:template match="/"&gt;</P>
<P>&lt;html&gt;</P>
<P>&lt;body&gt;</P>
<P>&lt;h2&gt;Transformed State Detail&lt;/h2&gt;</P>
<P>&lt;table border="1"&gt;</P>
<P>&lt;tr bgcolor="lightblue"&gt;</P>
<P>&lt;th align="left"&gt;Area Link&lt;/th&gt;</P>
<P>&lt;th align="left"&gt;Area Name&lt;/th&gt;</P>
<P>&lt;/tr&gt;</P>
<P>&lt;xsl:for-each select="<STRONG>/ns:html/ns:body/ns:div[@id='content']/ns:table[@class='sresults']/ns:tr/ns:td/ns:a</STRONG>"&gt;</P>
<P>&lt;tr&gt;</P>
<P>&lt;td&gt;&lt;xsl:value-of select="@href"/&gt;&lt;/td&gt;</P>
<P>&lt;td&gt;&lt;xsl:value-of select="@title"/&gt;&lt;/td&gt;</P>
<P>&lt;/tr&gt;</P>
<P>&lt;/xsl:for-each&gt;</P>
<P>&lt;/table&gt;</P>
<P>&lt;/body&gt;</P>
<P>&lt;/html&gt;</P>
<P>&lt;/xsl:template&gt;</P>
<P>&lt;/xsl:stylesheet&gt;</P>
<P>&nbsp;</P>
<P>The Java program that calls this stateStyleSheet is as follows:</P>
<P>&nbsp;&nbsp;&nbsp; SAXBuilder statesaxBuilder = new SAXBuilder("org.ccil.cowan.tagsoup.Parser", false);</P>
<P>&nbsp;&nbsp;&nbsp; org.jdom.Document stateDocument = statesaxBuilder.build("state.xml");</P>
<P>&nbsp;&nbsp;&nbsp; TransformerFactory factory = TransformerFactory.newInstance();</P>
<P>&nbsp;&nbsp;&nbsp; Transformer transformer = factory.newTransformer(new StreamSource("stateStyleSheet.xsl"));</P>
<P>&nbsp;&nbsp;&nbsp; JDOMSource source = new JDOMSource(stateDocument);</P>
<P>&nbsp;&nbsp;&nbsp; JDOMResult result = new JDOMResult();</P>
<P>&nbsp;&nbsp;&nbsp; transformer.transform(source, result);</P>
<P>&nbsp;&nbsp;&nbsp; Document tranformedDocument = result.getDocument();</P>
<P>&nbsp;&nbsp;&nbsp; ......</P>
<P>&nbsp;</P>
<P>Could this exception have been caused by incorrectly formatted stateStyleSheet? The search path "/ns:html/ns:body/ns:div[@id='content']/ns:table[@class='sresults']/ns:tr/ns:td/ns:a" has successfully worked in XPath such as the following lines:</P>
<P>&nbsp;</P>
<P>&nbsp;&nbsp;&nbsp; XPath statePath = XPath.newInstance("<STRONG>/ns:html/ns:body/ns:div[@id='content']/ns:table [@class='sresults']/ns:tr/ns:td/ns:a</STRONG>");</P>
<P>&nbsp;&nbsp;&nbsp; statePath.addNamespace("ns", <A href="http://www.w3.org/1999/xhtml">http://www.w3.org/1999/xhtml</A>);</P>
<P>&nbsp;</P>
<P>Whether including namespace ("ns") or not doesn't make any difference.</P>
<P>I am running JDK1.6, Netbeans 6.1, JDOM 1.1, Saxon 6.5, TagSoup 1.2 on Windows XP platform.</P>
<P>Your assistance would be much appreciated.</P>
<P>Many thanks,</P>
<P>Jack</P>
<P></P></FONT></DIV></div><br>



      <hr size=1>
Stay connected to the people that matter most with a smarter inbox. <a href="http://au.rd.yahoo.com/galaxy/mail/tagline2/*http://au.docs.yahoo.com/mail/smarterinbox" target=_blank>Take a look</a>.</body></html>