I am not an XSLT expert, but believe that in XSLT, "not" is a function, rather 
than an operator.

http://www.w3.org/TR/xpath-functions/#func-not

So, not(contains....)) rather than not  contains(....)  should presumably do 
the trick.

-----Original Message-----
From: Christopher Gross [mailto:cogr...@gmail.com] 
Sent: Thursday, August 18, 2011 7:44 AM
To: solr-user
Subject: XSLT Exception

I'm using Solr 3.3, trying to run an XSLT translation on the results
of a query.  The xsl file worked just fine for Solr 1.4.1, but I'm
having trouble with the newer version.

The root cause is:
javax.xml.transform.TransformerException: Extra illegal tokens:
'contains', '(', '$', 'posted', ',', ''00:00:00Z'', ')'

The XSL block is this:
                                <xsl:if test="string($posted)">
                                        <document:posted>
                                                <xsl:if test="contains($posted, 
'00:00:00Z')">
                                                        <xsl:attribute 
name="hasTime">false</xsl:attribute>
                                                </xsl:if>
                                                <xsl:if test="not 
contains($posted, '00:00:00Z')">
                                                        <xsl:attribute 
name="hasTime">true</xsl:attribute>
                                                </xsl:if>
                                                <xsl:value-of select="$posted"/>
                                        </document:posted>
                                </xsl:if>

The problem is that for whatever reason, the xsl doc isn't parsed
correctly, so it can't use the "contains" function.  Since the xsl
worked on a different version, I'm fairly certain that I'm just
missing a jarfile somewhere.  I've added the most recent Xalan I can
find (2.7.1), which allowed me to see the error I posted above.
Without it, I just get a general exception that it can't process the
xsl transform.

If anyone has an idea for something to try, I'd appreciate it.  Thanks!

-- Chris

Reply via email to