Jon Evans wrote:

I'm trying to write a sitemap fragment which will execute a text search
in a knowledge base product we are using.

I've managed to sort out a solution, using the cinclude transformer. For those interested, it works like this:

<map:match pattern="search">
  <map:generate
 src="http://example.com/interface?Action=CreateSession"/>
  <map:transform src="dosearch.xsl">
    <map:parameter name="use-request-parameters" value="true"/>
  </map:transform>
  <map:transform type="cinclude"/>
  <map:serialize type="xml"/>
</map:match>

dosearch.xsl looks like this:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
xmlns:cinclude="http://apache.org/cocoon/include/1.0";>


<xsl:param name="text"/>

<xsl:template match="SessionID">
<cinclude:include select="*|text()">
<xsl:attribute name="src">http://example.com/interface?Action=Search&amp;SessionID=<xsl:value-of select="."/>&amp;Text=<xsl:value-of select="$text"/>
</xsl:attribute>
</cinclude:include>
</xsl:template>


  <xsl:template match="node()|@*" priority="-1">
      <xsl:apply-templates/>
  </xsl:template>

</xsl:stylesheet>


It transforms the XML granting me a session id into a single cinclude tag, which then gets resolved by the cinclude tranformer in order to execute the search.


Jon


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to