xparse:org.apache.xalan.xslt.XSLProcessorException Urgent

Discussions

XML & Web services: xparse:org.apache.xalan.xslt.XSLProcessorException Urgent

  1. Hi All,
      I am trying to tranform a XML document into HTML and applying XSL styleheet. Transforamtion is done by XSLT. I am getting this error and I dont know what does this mean.

    XSL Error: Couldnot parse XSL Document
    XSL Error: SAX Exception
    xparse:org.apache.xalan.xslt.XSLProcessorException: pattern = '' Empty expression!

    Please tellme what I am doing wrong. I would appreciate any help.

    XSL is like this


    <?xml version="1.0" ?>
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" >
     <xsl:template match="/">
       <TABLE border="0">
        <xsl:apply-templates/>
       </TABLE>
     </xsl:template>
      <xsl:template match="part">
       <P>
        <tr>
         <td>
          <b>
           <font face="verdana" size="3">
            <xsl:value-of select="parent"/>
           </font>
           <br/>
           <br/>
          </b>
         </td>
        </tr>
       </P>
        <tr>
         <td>
          <b>
           <font face="verdana" size="2">
            <xsl:value-of select="" />
           </font>
          </b>
         </td>
        </tr>
         <tr>
          <td>
           <b>
            <font face="verdana" size="2">
             <xsl:value-of select="ebizsku" />
            </font>
           </b>
          </td>
         </tr>
         <tr>
          <td>
           <b>
           <font face="verdana" size="2">
            <xsl:value-of select="" />
           </font>
           </b>
          </td>
         </tr>
         <tr>
          <td>
           <b>
            <font face="verdana" size="2">
             <xsl:value-of select="family" />
            </font>
           </b>
          </td>
         </tr>
         <tr>
          <td>
           <b>
            <font face="verdana" size="2">
             <xsl:value-of select="" />
            </font>
           </b>
          </td>
         </tr>
        <!--prodsubhead-->
        <xsl:for-each select="list/item">
         <tr>
          <td>
           <ul>
            <li>
             <font face="verdana" size="2">
              <xsl:value-of select="body" />
             </font>
            </li>
           </ul>
          </td>
         </tr>
        </xsl:for-each>
    </xsl:template>
    </xsl:stylesheet>

    ThankYou Asad
  2. Hi asad!

    There are some lines with empty patterns in your xsl. For example : <xsl:value-of select=""/>
    If you dont want to select something, kill the line otherwise fill the select attribute with a name.
    greetings tarek
  3. Thanx it works....

  4. Hi
     When I do the transforamtion it gives me the following error.

    org.apache.xalan.xslt.XSLProcessorException: The root element is required in a well-formed document

    Input XSL; Line 1; Column 1
    XSL Error: Could not parse Input XSL document!
    XSL Error: SAX Exception


    What could be the reason. I am reading the XSL file which is stored in the database as CLOB. I pass the Reader Object to the XSLTInputSource
    Reader readis = remote.getXSLFile(xslid)

    XSLTInputSource xslsource = new XSLTInputSource(readis);
      /**Assign the Path to the result HTML file where u will store output**/
      String outputPath = application.getRealPath("jsp/transform/output.html");
      // PrintWriter outWriter = response.getWriter();

      /**Create a new XSTLResultTarget representing where the ouput will be sent **/
     XSLTResultTarget target = new XSLTResultTarget(outputPath);
      /** Get the XSLT Prcessor Instance **/
      XSLTProcessor processor = XSLTProcessorFactory.getProcessor();
      /** Do the Transforamtion **/
      processor.process(xmlsource,xslsource,target);

    If I use physical file from the server to do the transformation it works fine.

    Plz help me with this
    ThankYou
    Asad
  5. Hi,
    Try to display the contents of a file which your reading as a CLOB from the database, and compare with the physical file. There might be some differences in both the files' contents.

    Mukesh