Hi,
   I am using the SOLR XSLT response writer. My challenge is to convert some
fields in the schema from one value to another. I am using a map to do this.
Here's the sample XSLT file 

<xsl:stylesheet version="1.0"
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
 xmlns:my="my:my">
  <xsl:output omit-xml-declaration="yes" indent="yes"/>
  <xsl:strip-space elements="*"/>
  
  <my:map>
    <map>
      <item from="id" to="NewID" />
      <item from="ar" to="NewAR" />
    </map>
  </my:map>

  <xsl:variable name="vMap" select="document('')/*/my:map/*/*"/>
  
  <xsl:template match='/'>
    <IMAGES>
      <xsl:value-of select="$vMap[@from = 'id']/@to" />
    </IMAGES>
  </xsl:template>

</xsl:stylesheet>



Here's what the JSON response looks like


{
  "responseHeader":{
    "status":0,
    "QTime":0,
    "params":{
      "q":"car",
      "indent":"true",
      "fl":"id",
      "rows":"1",
      "wt":"json",
      "tr":"alamy.xsl"}},
  "response":{"numFound":202,"start":0,"docs":[
      {
        "id":"589587B2B1CA4C4683FC106967E7C326"}]
  }}


As you can see, I have an id field that I need to transform in to NewID as
per the stylesheet (the response will be in XML, the JSON is just a sample
document). 

However, when I make the request, I get the following SOLR error.

{msg=XSLT transformation error,trace=java.io.IOException: XSLT
transformation error
        at
org.apache.solr.response.XSLTResponseWriter.write(XSLTResponseWriter.java:111)
        at
org.apache.solr.servlet.SolrDispatchFilter.writeResponse(SolrDispatchFilter.java:765)
        at
org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:426)
        at
org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:207)
        at
org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1419)
        at
org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:455)
        at
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)
        at
org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:557)
        at
org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)
        at
org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1075)
        at
org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:384)
....


What could I be doing wrong? And how do I correct it?

Regards,
Sreekant






--
View this message in context: 
http://lucene.472066.n3.nabble.com/XSLT-with-maps-tp4218518.html
Sent from the Solr - User mailing list archive at Nabble.com.

Reply via email to