You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Nick Tackes <Ni...@Qstrategies.com> on 2000/07/17 02:59:13 UTC

pls help..xml topic: Can I pass a parameter to XML like this ...h ttp://localhost/xml/KPIList.xml?Boston

I am using a cocoon portlet in jetspeed where I specify an xml and
corresponding xslt.
I build an href link like this ...
 
http://localhost/xml/KPIList.xml?Boston
<http://localhost/xml/KPIList.xml?Boston> 
 
where I want to pass a parameter into the same xml.  This time, however, I
want the xslt to take this
parameter and filter further based on its value.
(incidentally, the link invokes cocoon directly, I did this by naming the
file .cxml and setting up my web server to direcly run these mime types
through cocoon.)
 
So how do I pass a parameter to an XML/XSLT , and more importantly, how do I
receive in the recieving document?
 
any assistance is greatly appreciated...
 
Cheers.
 
my xslt looks like this ....
********************
 
<?xml version="1.0"?>

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0" xmlns:java="http://xml.apache.org/xslt/java"
exclude-result-prefixes="java">

<xsl:template match="/">

<HTML>

<head>

<title>User KPI List</title>

</head>

<body>

<xsl:for-each select="TextKPIConfig/Group">

<div STYLE="background-color:#BEBEC6; color:black; padding:4px">

<xsl:variable name="rname" select="@Name"/>

<xsl:value-of select="@Name"/>

</div>

<table width="300">

<xsl:for-each select="TextKPI">

<xsl:if test="@Show='Y'">

<tr>

<td width="60%">

<xsl:value-of select="@Description"/>

</td>

<td>

<xsl:variable name="rlink" select="@Link"/>

<a href="{$rlink}" target="KPI Report">

<xsl:value-of select="@Value"/>

</a>

</td>

</tr>

</xsl:if>

</xsl:for-each>

<tr >

<td height="30"> 

<xsl:variable name="mlink"
select="concat('/content/xml/TESTKPI.CXML','?',@Name)"/>

<a href="{$mlink}" target="Global KPI List">More KPIs...</a>

</td>

</tr>

</table>

</xsl:for-each>

</body>

</HTML>

</xsl:template>

</xsl:stylesheet>

 
********************

Re: pls help..xml topic: Can I pass a parameter to XML like this ...h ttp://localhost/xml/KPIList.xml?Boston

Posted by Donald Ball <ba...@webslingerZ.com>.
On Sun, 16 Jul 2000, Nick Tackes wrote:

> I am using a cocoon portlet in jetspeed where I specify an xml and
> corresponding xslt.
> I build an href link like this ...
>  
> http://localhost/xml/KPIList.xml?Boston
> <http://localhost/xml/KPIList.xml?Boston> 
>  
> where I want to pass a parameter into the same xml.  This time, however, I
> want the xslt to take this
> parameter and filter further based on its value.
> (incidentally, the link invokes cocoon directly, I did this by naming the
> file .cxml and setting up my web server to direcly run these mime types
> through cocoon.)
>  
> So how do I pass a parameter to an XML/XSLT , and more importantly, how do I
> receive in the recieving document?

The simplest way is to use an HTTP request variable and to declare it in
your stylesheet using xsl:param. E.g.:

foo.xml?id=1

<xsl:param name="foo"/>

- donald