You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Christopher Gross <co...@gmail.com> on 2014/05/05 19:32:10 UTC
Odd XSLT behavior
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) > 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
Re: Odd XSLT behavior
Posted by Christopher Gross <co...@gmail.com>.
Checked that first -- it's a test site with a small sample size. The field
is set in all of the items. And refreshing the query a few times can yield
either result (with/without the error).
I'm reverting back to an old version of my stack (my code, plus tomcat &
solr), I'll step through my previous work slowly to see if I can pinpoint
what breaks it. If I can (ever) determine what caused it then I'll post it.
Thanks!
-- Chris
On Mon, May 5, 2014 at 2:05 PM, Chris Hostetter <ho...@fucit.org>wrote:
>
> 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) > 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/
>
Re: Odd XSLT behavior
Posted by Chris Hostetter <ho...@fucit.org>.
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) > 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/