Hi,
I am trying to develop a tag that would
- Get a parameter called "template-id" from the request
- Fetch the template with that template-id from an XML config file
Here's is how I am trying to accomplish it:
<!-- ===================================================================== -->
<!-- Fetch the template matching tempalte-id in Request -->
<xsl:template match="gvs:fetch-template">
<!-- Get template-id -->
<xsl:variable name="id">'<request:get-parameter name="template-id"/>'</xsl:variable>
<xsl:variable name="query-template">
<xsl:call-template name="get-template">
<xsl:with-param name="id" select="$id"/>
</xsl:call-template>
</xsl:variable>
<xsl:value-of select="$query-template"/>
</xsl:template>
<!-- Get Query Template from queries.xml, given its ID -->
<xsl:template name="get-template">
<xsl:param name="id"/>
<xsl:variable name="query-template"
select="document('../control/config/queries.xml')/gvs-site:queries/gvs-site:[EMAIL
PROTECTED]/template"/>
<xsl:value-of select="normalize-space($query-template)"/>
</xsl:template>
<!-- ===================================================================== -->
For reasons that I cannot think of, this does NOT work!
Interestingly, the following tag (which is essentially the "<!-- Get template-id -->"
section of the fetch-template tag) will correctly read the template-id from the
request:
<!-- Get the Template ID from Request -->
<xsl:template match="gvs:get-it">
<xsl:variable name="id">'<request:get-parameter name="template-id"/>'</xsl:variable>
<xsl:copy-of select="$id"/>
</xsl:template>
Also, If set the template-id to a static value in the fetch-template tag, it will
return the correct template from the XML file.
So the questions I have are:
1. How can I get this to work? Are there any other suggested methods?
2. Why does the tag fail as it exists?
I'd be grateful for any answers/pointers to the manuals/old threads, etc. :)
Thanks,
Sreedhar
PS: I am using Cocoon 2.0.4 with Tomcat 4.1 and Java 2 SE 1.3.1_07-b02
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]