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 faikeeyes <fa...@yahoo.com> on 2006/08/23 21:04:31 UTC

Xalan 2-7-0 problem

We have been running our application with xalan 2-6-0 fine. When I upgraded
to xalan-2-7-0 I get very strange error in one of my xml to xsl
transformation. The error that gets printed on the console is as follows

file:///C:/opt/eclipse/dummy.xsl; Line #0; Column #0;
java.lang.NullPointerException

There is no dummy.xsl file in the project. Following is the related xml and
xsl code

<snooper>
    <request-info>
        <request-protocol>HTTP/1.1</request-protocol>
        <request-method>GET</request-method>
        <server-name>localhost</server-name>
        <server-port>8080</server-port>
       
<request-uri>/uPortal/tag.d4b8ecf126ac31c5.render.userLayoutRootNode.uP</request-uri>
        <context-path>/uPortal</context-path>
       
<servlet-path>/tag.d4b8ecf126ac31c5.render.userLayoutRootNode.uP</servlet-path>
       
<query-string>uP_sparam=focusedTabID&amp;focusedTabID=81&amp;uP_sparam=mode&amp;mode=view</query-string>
        <path-info/>
        <path-translated/>
        <content-length>-1</content-length>
        <content-type/>
        <remote-user/>
        <remote-address>127.0.0.1</remote-address>
        <remote-host>127.0.0.1</remote-host>
        <authorization-scheme/>
        <locale>en_US</locale>
        <headers>
            <header name="host">localhost:8080</header>
            <header name="user-agent">Mozilla/5.0 (Windows; U; Windows
                NT 5.1; en-US; rv:1.8.0.6) Gecko/20060728
Firefox/1.5.0.6</header>
            <header
name="accept">text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5</header>
            <header name="accept-language">en-us,en;q=0.5</header>
            <header name="accept-encoding">gzip,deflate</header>
            <header
name="accept-charset">ISO-8859-1,utf-8;q=0.7,*;q=0.7</header>
            <header name="keep-alive">300</header>
            <header name="connection">keep-alive</header>
            <header
name="referer">http://localhost:8080/uPortal/render.userLayoutRootNode.uP</header>
            <header
name="cookie">JSESSIONID=BE1F4DF91564A2818FE42574BFB9AA02</header>
        </headers>
    </request-info>
    <channel-runtime-data>
        <locales>
            <locale code="en_US" displayName="English (United States)">
                <language displayName="English" iso2="en" iso3="eng"/>
                <country displayName="United States" iso2="US" iso3="USA"/>
                <variant code="" displayName=""/>
            </locale>
            <locale code="ja_JP" displayName="Japanese (Japan)">
                <language displayName="Japanese" iso2="ja" iso3="jpn"/>
                <country displayName="Japan" iso2="JP" iso3="JPN"/>
                <variant code="" displayName=""/>
            </locale>
            <locale code="sv_SE" displayName="Swedish (Sweden)">
                <language displayName="Swedish" iso2="sv" iso3="swe"/>
                <country displayName="Sweden" iso2="SE" iso3="SWE"/>
                <variant code="" displayName=""/>
            </locale>
            <locale code="de_DE" displayName="German (Germany)">
                <language displayName="German" iso2="de" iso3="deu"/>
                <country displayName="Germany" iso2="DE" iso3="DEU"/>
                <variant code="" displayName=""/>
            </locale>
        </locales>
    </channel-runtime-data>
</snooper>


And the XSL  code is as follows







<?xml version='1.0' encoding='utf-8' ?>

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
  <xsl:output indent="yes"/>
  <xsl:param name="locale">en_US</xsl:param>

  <xsl:template match="/">
    <xsl:apply-templates select="snooper"/>
  </xsl:template>
  
  <xsl:template match="snooper">
    <table width="100%" cellspacing="0" cellpadding="2" border="0">
      <tr>
        <td colspan="2" class="uportal-background-med">
  	      <span class="uportal-channel-table-caption"><xsl:value-of
select="$HTTP_REQUEST"/> </span>
        </td>
      </tr>
      <xsl:apply-templates select="request-info"/>
      <tr>
        <td colspan="2" class="uportal-background-med">
  	      <span class="uportal-channel-table-caption"><xsl:value-of
select="$HTTP_HEADER"/> </span>
        </td>
      </tr>
      <xsl:apply-templates select="request-info/headers"/>   
      <tr>
        <td colspan="2" class="uportal-background-med">
  	      <span class="uportal-channel-table-caption"><xsl:value-of
select="$CHANNEL_RUNTIME"/> </span>
        </td>
      </tr>
      <xsl:apply-templates select="channel-runtime-data"/>   
    </table>
  </xsl:template>

  <xsl:template match="request-info">
    <tr>
      <td nowrap="nowrap" valign="top" align="right"
class="uportal-background-light"><span
class="uportal-channel-table-row-even"><xsl:value-of
select="$REQUEST_PROTOCOL"/> </span></td>
      <td class="uportal-channel-table-row-odd"><xsl:value-of
select="request-protocol"/></td>
    </tr>  
    <tr>
      <td nowrap="nowrap" valign="top" align="right"
class="uportal-background-light"><span
class="uportal-channel-table-row-even"><xsl:value-of
select="$REQUEST_METHOD"/> </span></td>
      <td width="100%" class="uportal-channel-table-row-odd"><xsl:value-of
select="request-method"/></td>
    </tr>
    <tr>
      <td nowrap="nowrap" valign="top" align="right"
class="uportal-background-light"><span
class="uportal-channel-table-row-even"><xsl:value-of select="$SERVER_NAME"/>
</span></td>
      <td class="uportal-channel-table-row-even"><xsl:value-of
select="server-name"/></td>
    </tr>
    <tr>
      <td nowrap="nowrap" valign="top" align="right"
class="uportal-background-light"><span
class="uportal-channel-table-row-even"><xsl:value-of select="$SERVER_PORT"/>
</span></td>
      <td class="uportal-channel-table-row-odd"><xsl:value-of
select="server-port"/></td>
    </tr>    
    <tr>
      <td nowrap="nowrap" valign="top" align="right"
class="uportal-background-light"><span
class="uportal-channel-table-row-even"><xsl:value-of select="$REQUEST_URI"/>
</span></td>
      <td class="uportal-channel-table-row-even"><xsl:value-of
select="request-uri"/></td>
    </tr>
    <tr>
      <td nowrap="nowrap" valign="top" align="right"
class="uportal-background-light"><span
class="uportal-channel-table-row-even"><xsl:value-of
select="$CONTEXT_PATH"/> </span></td>
      <td class="uportal-channel-table-row-even"><xsl:value-of
select="context-path"/></td>
    </tr>        
    <tr>
      <td nowrap="nowrap" valign="top" align="right"
class="uportal-background-light"><span
class="uportal-channel-table-row-even"><xsl:value-of
select="$SERVLET_PATH"/> </span></td>
      <td class="uportal-channel-table-row-even"><xsl:value-of
select="servlet-path"/></td>
    </tr>
    <tr>
      <td nowrap="nowrap" valign="top" align="right"
class="uportal-background-light"><span
class="uportal-channel-table-row-even"><xsl:value-of
select="$QUERY_STRING"/> </span></td>
      <td class="uportal-channel-table-row-odd"><xsl:value-of
select="query-string"/></td>
    </tr>    
    <tr>
      <td nowrap="nowrap" valign="top" align="right"
class="uportal-background-light"><span
class="uportal-channel-table-row-even"><xsl:value-of select="$PATH_INFO"/>
</span></td>
      <td class="uportal-channel-table-row-odd"><xsl:value-of
select="path-info"/></td>
    </tr>
    <tr>
      <td nowrap="nowrap" valign="top" align="right"
class="uportal-background-light"><span
class="uportal-channel-table-row-even"><xsl:value-of
select="$PATH_TRANSLATED"/> </span></td>
      <td class="uportal-channel-table-row-even"><xsl:value-of
select="path-translated"/></td>
    </tr>
    <tr>
      <td nowrap="nowrap" valign="top" align="right"
class="uportal-background-light"><span
class="uportal-channel-table-row-even"><xsl:value-of
select="$CONTENT_LENGTH"/> </span></td>
      <td class="uportal-channel-table-row-even"><xsl:value-of
select="content-length"/></td>
    </tr>
    <tr>
      <td nowrap="nowrap" valign="top" align="right"
class="uportal-background-light"><span
class="uportal-channel-table-row-even"><xsl:value-of
select="$CONTENT_TYPE"/> </span></td>
      <td class="uportal-channel-table-row-odd"><xsl:value-of
select="content-type"/></td>
    </tr>
    <tr>
      <td nowrap="nowrap" valign="top" align="right"
class="uportal-background-light"><span
class="uportal-channel-table-row-even"><xsl:value-of select="$REMOTE_USER"/>
</span></td>
      <td class="uportal-channel-table-row-even"><xsl:value-of
select="remote-user"/></td>
    </tr>
    <tr>
      <td nowrap="nowrap" valign="top" align="right"
class="uportal-background-light"><span
class="uportal-channel-table-row-even"><xsl:value-of
select="$REMOTE_ADDRESS"/> </span></td>
      <td class="uportal-channel-table-row-odd"><xsl:value-of
select="remote-address"/></td>
    </tr>
    <tr>
      <td nowrap="nowrap" valign="top" align="right"
class="uportal-background-light"><span
class="uportal-channel-table-row-even"><xsl:value-of select="$REMOTE_HOST"/>
</span></td>
      <td class="uportal-channel-table-row-even"><xsl:value-of
select="remote-host"/></td>
    </tr>
    <tr>
      <td nowrap="nowrap" valign="top" align="right"
class="uportal-background-light"><span
class="uportal-channel-table-row-even"><xsl:value-of
select="$AUTHORIZATION_SCHEME"/> </span></td>
      <td class="uportal-channel-table-row-odd"><xsl:value-of
select="authorization-scheme"/></td>
    </tr>
    <tr>
      <td nowrap="nowrap" valign="top" align="right"
class="uportal-background-light"><span
class="uportal-channel-table-row-even"><xsl:value-of select="$LOCALE"/>
</span></td>
      <td class="uportal-channel-table-row-even"><xsl:value-of
select="locale"/></td>
    </tr>
  </xsl:template>

  <xsl:template match="headers">
    <xsl:apply-templates select="header"/>
  </xsl:template>

  <xsl:template match="header">
    <tr>
      <td nowrap="nowrap" valign="top" align="right"
class="uportal-background-light">
        <!-- The choose block here fixes a spelling error in the HTTP
headers.
             'Referer' should be changed to 'Referrer' -->
        <p class="uportal-channel-table-row-even">
        <xsl:choose>
          <xsl:when test="@name = 'Referer'">
            <xsl:value-of select="$REFERRER"/>
          </xsl:when>
          <xsl:otherwise>
            <xsl:value-of select="@name"/>: 
          </xsl:otherwise>
        </xsl:choose>
        </p>
      </td>
      <td>
        <xsl:attribute name="class">
          <xsl:choose>
            <xsl:when test="position() mod 2 =
0">uportal-channel-table-row-even</xsl:when>
            <xsl:otherwise>uportal-channel-table-row-odd</xsl:otherwise>
          </xsl:choose>
        </xsl:attribute>
        <xsl:value-of select="."/>
      </td>
    </tr>
  </xsl:template> 

  <xsl:template match="channel-runtime-data">
    <xsl:apply-templates select="locales"/>
  </xsl:template>
  
  <xsl:template match="locales">
    <tr>
      <td nowrap="nowrap" valign="top" align="right"
class="uportal-background-light"><p
class="uportal-channel-table-row-even"><xsl:value-of select="$LOCALES"/>
</p></td>
      <td class="uportal-channel-table-row-odd">
        <table border="0" cellspacing="1" cellpadding="1">
          <tr>
            <td class="uportal-channel-table-row-odd"><u><xsl:value-of
select="$NAME"/></u></td>
            <td class="uportal-channel-table-row-odd"><u><xsl:value-of
select="$CODE"/></u></td>
            <td class="uportal-channel-table-row-odd"><u><xsl:value-of
select="$LANGUAGE"/></u></td>
            <td class="uportal-channel-table-row-odd"><u><xsl:value-of
select="$COUNTRY"/></u></td>
            <td class="uportal-channel-table-row-odd"><u><xsl:value-of
select="$VARIANT"/></u></td>
          </tr>
          <xsl:apply-templates select="locale"/>   
        </table>
      </td>
    </tr>  
  </xsl:template>  
  
  <xsl:template match="locale">
    <tr>
      <td class="uportal-channel-table-row-odd"
nowrap="nowrap"><xsl:value-of select="@displayName"/></td>
      <td class="uportal-channel-table-row-odd"
nowrap="nowrap"><xsl:value-of select="@code"/></td>
      <td class="uportal-channel-table-row-odd"
nowrap="nowrap"><xsl:value-of select="language/@displayName"/>
(<xsl:value-of select="language/@iso2"/>, <xsl:value-of
select="language/@iso3"/>)</td>
      <td class="uportal-channel-table-row-odd"
nowrap="nowrap"><xsl:value-of select="country/@displayName"/> (<xsl:value-of
select="country/@iso2"/>, <xsl:value-of select="country/@iso3"/>)</td>
      <td class="uportal-channel-table-row-odd"
nowrap="nowrap"><xsl:value-of select="variant/@displayName"/> (<xsl:value-of
select="variant/@code"/>)</td>
    </tr>
  </xsl:template>

</xsl:stylesheet>


Any help will be greatly appreciated. Thanks a lot.
http://www.nabble.com/user-files/235725/snooper.xml snooper.xml 
http://www.nabble.com/user-files/235726/snooper.xsl snooper.xsl 
-- 
View this message in context: http://www.nabble.com/Xalan-2-7-0-problem-tf2154236.html#a5950680
Sent from the Xalan - J - Users forum at Nabble.com.


Re: Xalan 2-7-0 problem

Posted by Henry Zongaro <zo...@ca.ibm.com>.
Hello.

faikeeyes <fa...@yahoo.com> wrote on 2006-08-23 03:04:31 PM:
> We have been running our application with xalan 2-6-0 fine. When I 
upgraded
> to xalan-2-7-0 I get very strange error in one of my xml to xsl
> transformation. The error that gets printed on the console is as follows
> 
> file:///C:/opt/eclipse/dummy.xsl; Line #0; Column #0;
> java.lang.NullPointerException

I do not seem to be able to reproduce the problem with either Xalan-J 
2.7.0 or by building from the latest version of the source code.  I had to 
insert many variable declarations that were missing from your sample 
stylesheet.  I don't know whether the cause of the problem might lie 
within the declarations of those variables in the original stylesheets.

Could I ask you to try to produce a complete, stand-alone test that 
demonstrates the problem?  If a Java driver program is required to 
reproduce the problem, please inlucde that as well.

Thanks,

Henry
------------------------------------------------------------------
Henry Zongaro      XSLT Processors Development
IBM SWS Toronto Lab   T/L 969-6044;  Phone +1 905 413-6044
mailto:zongaro@ca.ibm.com