XSLT Template for GSA DB Connector result

99 views
Skip to first unread message

Thomas Fowler

unread,
Jul 17, 2012, 10:39:09 AM7/17/12
to Google-Search-...@googlegroups.com
Hi all

I am trying to develop a custom XSLT stylesheet for the returned result from an external (offboard) DB connector.

However, while I'm developing, I would love to be able to parse some test xml through the XSLT to be able to debug the output, in a similar fashion as to how one would develop a custom frontent for the GSA.

My problem is that I'm not quite sure how to get the GSA to give me a dump of the XML that is passed to the XSLT template so that I can use it to test/debug the XSLT.

Is anyone able to point me in the right direction?

Thanks in advance

Tom Fowler

Mathias Bierl

unread,
Jul 17, 2012, 11:06:10 AM7/17/12
to Google-Search-...@googlegroups.com
Hello

You just have to to a normal search on the GSA and then replace the url parameter output ->  output=xml 

Then you get the xml result which will be used by the GSA XSLT Processor

Dave Watts

unread,
Jul 17, 2012, 11:27:57 AM7/17/12
to google-search-...@googlegroups.com
> You just have to to a normal search on the GSA and then replace the url
> parameter output -> output=xml
>
> Then you get the xml result which will be used by the GSA XSLT Processor

Actually, I think this is incorrect - at least, it's incorrect on my
appliances (6.12 through 6.14).

You have to remove the proxystylesheet parameter entirely. This will
return the "raw" XML. Changing the output parameter has no effect
unless you remove the proxystylesheet parameter, and the only effect
it does have once you've removed the proxystylesheet parameter is to
inject a DOCTYPE directive if you set the value to "xml".

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
http://training.figleaf.com/

Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on
GSA Schedule, and provides the highest caliber vendor-authorized
instruction at our training centers, online, or onsite.

Mathias Bierl

unread,
Jul 17, 2012, 11:37:41 AM7/17/12
to Google-Search-...@googlegroups.com, google-search-...@googlegroups.com
Yes you're right: In the current version this doesn't work anymore. Now also the proxystylesheet parameter has to be removed from the url

Thomas Fowler

unread,
Jul 17, 2012, 8:08:18 PM7/17/12
to Google-Search-...@googlegroups.com, google-search-...@googlegroups.com
Thanks for the prompt response guys. Much appreciated.

However, there is every possibility I'm being a bit of a dunce.

Unlike when you remove the proxystylesheet parameter while conducting a search, and you get the raw XML without the frontend xslt being applied, when I perform the same scenario on a returned index'd item from a DB connector, I only get a BLOB xml element: <BLOB encoding="ISO-8859-1">BLOB data here</BLOB> I will provide exactly what I receive at the end of the post minus the actual blob data - there may well be sensitive info in there....

So, while passing this through Oxygen to debug my XSLT I obviously dont get an expected result. Am I missing a trick here? Clearly I've not quite got this figure out yet....

Thanks again.

Tom

<GSP VER="3.2">
<CACHE>
<CACHE_URL>
googleconnector://applicant.localhost/doc?docid=OTE0NzI5
</CACHE_URL>
<CACHE_REDIR_URL>
googleconnector://applicant.localhost/doc?docid=OTE0NzI5
</CACHE_REDIR_URL>
<CACHE_LAST_MODIFIED>Tue, 17 Jul 2012 20:52:51 +0200</CACHE_LAST_MODIFIED>
<CACHE_CONTENT_TYPE>text/html</CACHE_CONTENT_TYPE>
<CACHE_LANGUAGE>en</CACHE_LANGUAGE>
<CACHE_ENCODING>ISO-8859-1</CACHE_ENCODING>
<CACHE_HTML>
<BLOB encoding="ISO-8859-1">
</BLOB>
</CACHE_HTML>
</CACHE>
</GSP>

Mathias Bierl

unread,
Jul 18, 2012, 8:32:21 AM7/18/12
to Google-Search-...@googlegroups.com, google-search-...@googlegroups.com
Your output doesn't look like the normal xml output of a GSA search. It looks like the the cached version xml output.
You have to export the xml output of a direct search and this you can use then for testing your xslt stylesheet.
It should look like:

<GSP VER="3.2">
<TM>0.100086</TM>
<Q>test</Q>
<PARAM name="q" value="test" original_value="test"/>
<PARAM name="site" value="default_collection" original_value="default_collection"/>
<PARAM name="btnG" value="Google Search" original_value="Google+Search"/>
<PARAM name="access" value="p" original_value="p"/>
<PARAM name="client" value="default_frontend" original_value="default_frontend"/>
<PARAM name="output" value="xml_no_dtd" original_value="xml_no_dtd"/>
<PARAM name="xproxystylesheet" value="default_frontend" original_value="default_frontend"/>
<PARAM name="sort" value="date:D:L:d1" original_value="date:D:L:d1"/>
<PARAM name="oe" value="UTF-8" original_value="UTF-8"/>
<PARAM name="ie" value="UTF-8" original_value="UTF-8"/>
<PARAM name="ud" value="1" original_value="1"/>
<PARAM name="exclude_apps" value="1" original_value="1"/>
<PARAM name="ip" value="192.168.86.6" original_value="192.168.86.6"/>
<PARAM name="entqr" value="3" original_value="3"/>
<PARAM name="entqrm" value="0" original_value="0"/>
<RES SN="1" EN="10">
<M>525</M>
<FI/>
<NB>
<NU>
/search?q=test&site=default_collection&lr=&ie=UTF-8&oe=UTF-8&output=xml_no_dtd&client=default_frontend&access=p&sort=date:D:L:d1&start=10&sa=N
</NU>
</NB>
<R N="1">
<T><b>Test</b> : home</T>
<RK>10</RK>
<ENT_SOURCE>T3-DBPR4YTTRWWQY</ENT_SOURCE>
<FS NAME="date" VALUE=""/>
<S>
<b>...</b> Willkommen auf der Webseite
</S>
<LANG>de</LANG>
<HAS>
<L/>
<C SZ="5k" CID="xxxxxxx" ENC="windows-1252"/>
</HAS>
</R>
....
</RES>
</GSP>

Thomas Fowler

unread,
Jul 19, 2012, 7:13:52 PM7/19/12
to google-search-...@googlegroups.com
Thanks Mathias

But I think we are missing eachother

I am trying to build a specific XSLT to be used in the offboard database connector, not in a custom frontend.

As such, I am trying to find the XML that the connector (I'm assuming?) passes through the XSL template in order to generate the feed for the GSA to ingest.

I hope that makes sense...?

Thanks again.

Tom

--
You received this message because you are subscribed to the Google Groups "Google Search Appliance/Google Mini" group.
To view this discussion on the web visit https://groups.google.com/d/msg/Google-Search-Appliance-Help/-/kvdO3yknIo8J.

To post to this group, send email to Google-Search-...@googlegroups.com.
To unsubscribe from this group, send email to Google-Search-Applia...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/Google-Search-Appliance-Help?hl=en.

Message has been deleted

Edwin Stauthamer

unread,
Jul 20, 2012, 3:10:22 AM7/20/12
to google-search-...@googlegroups.com
So to be sure,

The XSL that you define in the configuration page of the off-board DB connector is used by the GSA to parse the feed XML from the connector-manager ON THE GSA?

I don't think this is correct.

The process is like this:
1. The DB connector connects to the DB and extracts the records. 
2. before sending the records to the connector-manager, the DB connector uses the XSL stylesheet to transform the raw XML to, say HTML.
3. The DB connector encodes the records as base64 and sends them to the connector-manager for processing
4. the connector-manager aggregates the records into feeds and sends them to the GSA.

To be able to use all individual fields from the database records for filtering and presenting I have an XSL-stylesheet that transforms the XML to HTML and puts all records into <meta> elements in the HTML HEAD.

Based on that XSL you are able to get a understanding of the XML it transforms.

====
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="/">
<html>
<head>
<xsl:for-each select="intp"> <!-- name of database -->

  <!-- now for every single field from the database you want to be able to filter upon or show in your result, add a meta-field -->
  <title><xsl:value-of select="FULL_NAME"/></title> <!-- don't forget the title -> that is the default title in the GSA result -->
  <meta name="employee_id"><xsl:attribute name="content"><xsl:value-of select="EMPLOYEE_ID"/></xsl:attribute></meta> 
  <!-- mind the capital sensitivity of XML, dependend on the notation in you db view or table the value-of should be in capitals or not -->
  <meta name="full_name"><xsl:attribute name="content"><xsl:value-of select="FULL_NAME"/></xsl:attribute></meta>
  <meta name="last_name"><xsl:attribute name="content"><xsl:value-of select="LAST_NAME"/></xsl:attribute></meta>
  <meta name="first_name"><xsl:attribute name="content"><xsl:value-of select="FIRST_NAME"/></xsl:attribute></meta>
  <!-- Etc..... -->
  
</xsl:for-each>
<!-- You can add static metadata to -->
<meta name="category" content="Person"/>
</head>
<body>
<!-- Just see what data you want in the content-field -->
<xsl:for-each select="intp"> <!-- Name of database -->
  <h1><xsl:value-of select="FULL_NAME"/></h1>
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet> 
====

2012/7/20 Rishi Kandel <ris...@bluepoint.net.au>

Hi Thomas,

The connector doesn't pass the XML content through the XSL. Passing the XML through the XSL and parsing it is GSA's task. That's why, I think; there is a bit of confusion between your question and answer from other people.

However, to answer your question, you can download the XML dump passed by the connector under Crawl and Index --> Feeds. As of now, there is no direct mechanism to manipulate the XML content between the Connector and the GSA.

But if you are technically savvy, have some time and looking for challenge; you can write a "Pass Through" application and pass the content from connector  (Off-Board Connector) to the pass through application then you can manipulate that XML.

I hope this helps.

Regards,
Rishi Kandel
BluePoint Development

Tom


To post to this group, send email to Google-Search-Appliance-Help@googlegroups.com.
To unsubscribe from this group, send email to Google-Search-Appliance-Help+unsub...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Google Search Appliance/Google Mini" group.

To post to this group, send email to Google-Search-...@googlegroups.com.
To unsubscribe from this group, send email to Google-Search-Applia...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/Google-Search-Appliance-Help?hl=en.



--
Met vriendelijke groet,

Edwin Stauthamer
ed...@stauthamer.net
(+31) (0) 6 45554994

Thomas Haeske

unread,
Oct 31, 2012, 12:51:08 PM10/31/12
to Google-Search-...@googlegroups.com
Hello,

I've got an additional question in this context. I try to debug a front-end-xslt (a modified standard-front-end) with the searchresult.xml (normal GSA-output). There are included xsl-files like expertsearch.xsl. How can I download theses xsl-files?
http://gsa1/expertsearch.xsl doesn't work.

Best regards

Mathias Bierl

unread,
Oct 31, 2012, 1:41:31 PM10/31/12
to Google-Search-...@googlegroups.com
These are the xsl files which is under the new feature expertsearch but for debugging the main frontend stylesheet you can just make an empty xsl file with this name and put it into the same directory

Greg Rairdon

unread,
Feb 20, 2014, 10:11:58 AM2/20/14
to Google-Search-...@googlegroups.com
Can the expertsearch.xsl be grabbed from the GSA?

Mathias Bierl

unread,
Feb 20, 2014, 10:13:46 AM2/20/14
to Google-Search-...@googlegroups.com
No, I got it from Google support by opening a ticket
Reply all
Reply to author
Forward
0 new messages