cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Swearingen <davi...@yahoo.com>
Subject RE: (Easy) Passing a Variable From Sitemap to StyleSheet?
Date Wed, 14 Apr 2004 01:52:28 GMT
I posted earlier this week about needing to pass a variable from the
sitemap to a stylesheet, and I understand how to do this, but I'm
getting a weird error now.  [NOT SURE HOW TO ESCAPE HTML FOR POSTS TO
MAILING LIST.]

I'm setting the variable in the sitemap as follows:

<map:match pattern="cinc2/*.html">
	<map:generate src="cinc2/template.xml"/>
	<map:transform type="cinclude">
		<map:parameter name="requestedfile" value="{1}"/>
	</map:transform>
	...
	
My file template.xml WORKS when hard-coded (cheating) with a filename,
as follows:

...
<thebody>
	<cinclude:include src="cinc2/mybody.xml"/>
</thebody>
...

but in reality I need the filename parameterized as follows:

...
<xsl:param name="requestedfile"/>
...
<thebody>
	<cinclude:include><xsl:attribute name="src"><xsl:value-of
select="$requestedfile"/></xsl:attribute></cinclude:include>
</thebody>
...

This throws an error as follows:

"org.apache.cocoon.ProcessingException: Failed to execute pipeline.:
org.xml.sax.SAXException: Missing 'src' attribute on cinclude:include
element"

I can't even get this to work, as a test, where I hard-code the
attribute value:

<thebody>
	<cinclude:include><xsl:attribute
name="src">cinc2/mybody.xml</xsl:attribute></cinclude:include>
</thebody>

Thanks for any assistance.  

David



--- Philipp Burkert <philipp@burkert.de> wrote:
> Hi,
> 
> > I thought this would be easy...I'm trying to pass a variable 
> > defined in the Sitemap, and retrieve it in the Stylesheet.
> 
> first you have to handle the parameter to the transformer within the
> sitemap.
> 
> ---sitemap--
> <map:match pattern="*/show.html">
>    <map:generate src="xmldb:xindice-embed:///db/beschlusslage/"/>
>    <map:transform type="xslt" src="xslt/antrag2html.xslt">
> 	<map:parameter name="oid" value="{1}"/>
>    </map:transform> 
>    ....
> ------------
> 
> Then you have to
> - declare the parameter in the xslt
> - and output it later with the $varname syntax
> 
> ---xslt--
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> 	<xsl:output method="xml" version="1.0" encoding="UTF-8"
> indent="yes"/>
> 	<xsl:param name="oid"/>
>       ...
> 	<xsl:template match="meta" name="antrag">
>          <xsl:value-of select="$oid"/>
>       ...
> ------------
> 
> Hope that helps
> 
> PHILIPP BURKERT
> philipp@burkert.de
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 



	
		
__________________________________
Do you Yahoo!?
Yahoo! Tax Center - File online by April 15th
http://taxes.yahoo.com/filing.html

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message