You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by David Swearingen <da...@yahoo.com> on 2004/04/12 02:20:44 UTC
RE: (Easy) Passing a Variable From Sitemap to StyleSheet? - One complication
Indeed I can use the variable in the stylesheet as described below by
Philip but I failed to anticipate that I have to use the variable
INSIDE of another tag, that is, I have a variable foo that represents a
filename and I have to use it as follows:
[cinclude:include src="foo.xml"]
I'm assuming I can't nest a xsl:value-of tag inside of a
cinclude:include tag...how would I render this value in this manner?
Thanks,
David
--- Philipp Burkert <ph...@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
RE: (Easy) Passing a Variable From Sitemap to StyleSheet? - One
complication
Posted by Conal Tuohy <co...@paradise.net.nz>.
Hi David. This is more of an XSLT question now really, if I understand you
correctly.
You should use attribute value templates (i.e. curly braces):
<xsl:variable name="foo"/>
...
<cinclude:include src="{$foo}"/>
You could indeed use xsl:value-of, like this:
<cinclude:include>
<xsl:attribute name="src">
<xsl:value-of select="$foo"/>
</xsl:attribute>
</cinclude:include>
... which is a bit wordy. The "attribute value template" approach above is
functionally identical - it's just a handy shorthand syntax.
Cheers
Con
> -----Original Message-----
> From: David Swearingen [mailto:david25@yahoo.com]
> Sent: Monday, 12 April 2004 12:21
> To: users@cocoon.apache.org
> Subject: RE: (Easy) Passing a Variable From Sitemap to
> StyleSheet? - One
> complication
>
>
> Indeed I can use the variable in the stylesheet as described below by
> Philip but I failed to anticipate that I have to use the variable
> INSIDE of another tag, that is, I have a variable foo that
> represents a
> filename and I have to use it as follows:
>
> [cinclude:include src="foo.xml"]
>
> I'm assuming I can't nest a xsl:value-of tag inside of a
> cinclude:include tag...how would I render this value in this manner?
>
> Thanks,
> David
>
>
> --- Philipp Burkert <ph...@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
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org