Shot in the dark: perhaps you have a doc w/o a value in the description 
field, which means the xsl:variable's select doesn't match anything; which 
perhaps means that your XSLT engine then leaves the variable undefined.


: Solr 4.7.2 (and 4.6.1)
: Tomcat 7.0.52
: Java 1.7.0_45 (and _55)
: 
: I'm getting some really odd behavior with some XSLT documents.  I've been
: doing some upgrades to Java & Solr and I'm trying to narrow down where the
: problems are happening.
: 
: I have a few XSLT docs that I put into the conf/xslt directory for my
: indexes  I haven't changed the in a while, and they were working fine for a
: 3.X Solr, and seemed to work fine on an earlier 4.X release.
: 
: The problem is that sometimes I get an error saying that a field can't be
: found.   Here's a slice of the XSLT:
:   <xsl:template match="doc">
:     <xsl:variable name="id" select="str[@name='id']"/>
:     <xsl:variable name="url" select="str[@name='url']"/>
:     <xsl:variable name="title" select="str[@name='title']"/>
:     <xsl:variable name="description" select="str[@name='description']"/>
: 
:     <entry xmlns="http://www.w3.org/2005/Atom";>
:       <title><xsl:value-of select="str[@name='title']"/></title>
:       <link>
:         <xsl:attribute name="href"><xsl:value-of select="str[@name='url']"
: /></xsl:attribute>
:       </link>
:       <summary>
:         <xsl:choose>
:           <xsl:when test="string-length($description) &gt; 255">
:             <xsl:value-of select="concat(substring($description, 1, 255),
: '...')"/>
:           </xsl:when>
:           <xsl:otherwise>
:             <xsl:value-of select="$description"/>
:           </xsl:otherwise>
:         </xsl:choose>
:        </summary>
:    .....
: </xsl:template>
: 
:    I get messages saying that it can't find the "description" variable.
: This was working perfectly well, but I can't seem to narrow down a specific
: change that caused this.
: 
: Caused by: javax.xml.transform.TransformerConfigurationException:
: solrres:/xslt/osatom.xsl: line 115: Variable or parameter 'description' is
: undefined.
:         at
: 
com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:964)
:         at
: 
org.apache.solr.util.xslt.TransformerProvider.getTemplates(TransformerProvider.java:110)
: 
: Has anyone run into a problem like this?  Thanks!
: 
: -- Chris
: 

-Hoss
http://www.lucidworks.com/

Reply via email to