[xsl] XDQL query

Subject: [xsl] XDQL query
From: "Tiffany Blake" <Tiffany_Blake@xxxxxxx>
Date: Thu, 17 Mar 2005 11:14:49 -0800
all our stylesheets build <meta> tags as follows:

	<xsl:text disable-output-escaping="yes">
		&lt;meta name="keywords" content="</xsl:text>
	<xsl:value-of select="search_keywords"/>
	<xsl:text disable-output-escaping="yes">"&gt;</xsl:text>

now i need to invoke an XSLT processor to create an XDQL query to build a 2nd
<meta> tag:

	<xsl:text disable-output-escaping="yes">
		&lt;meta name="Description" content="</xsl:text>
	<xsl:value-of
select="xalan-nodeset:nodeset($query1_results)/root/object/description"/>
	<xsl:text disable-output-escaping="yes">"&gt;</xsl:text>

my stylesheet is valid, but can't generate a webpage - any ideas??

------------------------------
code snipets...the only NEW code is #3, 4, 5

1. all our stylesheets declare a namespace to use Apache Xalan XSLT processor:
	<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
	xmlns:java="http://xml.apache.org/xslt/java";
	xmlns:xalan-nodeset = "http://xml.apache.org/xalan";
	exclude-result-prefixes = "xalan"
	version="1.0">

2. then create default session id for the processor:
<xsl:param name="DMS_SESSION_ID" select="'default value'"/>

3. (NEW code) then declare variables for the java calls and dump results into
the "queryresult" variable:
<!-- XDQL - Add template to handle XDQL -->
<xsl:template name="XDQL">
 <xsl:param name="dql"/>
 <xsl:param name="includecontent" select="string('true')"/>
 <xsl:param name="ContentEncoding" select="string('dom')"/>
 <xsl:param name="ContentTag" select="string('content')"/>
 <xsl:param name="ContentFormat" select="string('xml')"/>
 <xsl:param name="UseGivenCaseTagNames" select="true"/>
 <xsl:param name="ErrorTag" select="string('XDQLError')"/>

 <!-- create and init xdql class and specify dql query -->
 <xsl:variable name="xdql"
select="java:com.documentum.xml.xdql.DfXmlQuery.new()"/>
 <xsl:variable name="init" select="java:init($xdql)"/>

 <!-- set the properties of query object -->
 <xsl:variable name="param" select="java:setDql($xdql,$dql)" />
 <xsl:variable name="param" select="java:includeContent($xdql,false())"/>
 <xsl:variable name="param" select="java:setContentTag($xdql,$ContentTag)"/>
 <xsl:variable name="param"
select="java:setContentEncoding($xdql,$ContentEncoding)"/>
 <xsl:variable name="param"
select="java:setContentFormat($xdql,$ContentFormat)"/>
 <xsl:variable name="param" select="java:useGivenCaseTagNames($xdql)"/>
 <xsl:variable name="param" select="java:setErrorTag($xdql,$ErrorTag)"/>

 <!-- execute and return pure xml -->
 <xsl:variable name="execute"
select="java:execute($xdql,'DF_READ_QUERY',$DMS_SESSION_ID)"/>
 <xsl:variable name="queryresult" select ="java:getXMLDOM($xdql)"/>

 <xsl:copy-of select="$queryresult" />

</xsl:template>

4. (NEW code) then  call the above template ("XDQL") and store results in
"query1_results" variable:
<xsl:variable name = "query1">select r_object_id, search_keywords, description
from gapinc_web_content where r_object_id ='<xsl:value-of
select="$DMS_INPUT_OBJECT_ID"/>'</xsl:variable>
<xsl:variable name = "query1_results">
	<xsl:call-template name="XDQL">
		<xsl:with-param name="dql" select="string($query1)"/>
   </xsl:call-template>
</xsl:variable>

5. (NEW code) finally implement nodeset function:
<xsl:text disable-output-escaping="yes">&lt;meta name="Keywords"
content="</xsl:text>
	<xsl:value-of select="search_keywords"/>
	<xsl:text disable-output-escaping="yes">"&gt;&lt;meta name="Description"
content="</xsl:text>
	<xsl:value-of
select="xalan-nodeset:nodeset($query1_results)/root/object/description"/>
	<xsl:text disable-output-escaping="yes">"&gt;</xsl:text>


let me know,
tiffany_blake@xxxxxxx

Current Thread