cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "John Menke" <j...@eagleinfosystems.com>
Subject RE: Dynamic selection of stylesheets
Date Fri, 09 Feb 2001 00:30:30 GMT
Somebody answered this question under a different subject:

This works:

<xsp:logic>
	String stylesheet = "filename.xsl";
</xsp:logic>

 <xsp:pi target="xml-stylesheet">
                href="<xsp:expr>stylesheet</xsp:expr>"
                type="text/xsl"
</xsp:pi>

> -----Original Message-----
> From: John Menke [mailto:john@eagleinfosystems.com]
> Sent: Thursday, February 08, 2001 6:59 PM
> To: Cocoon-Users Apache.
> Subject: Dynamic selection of stylesheets
>
>
> I have been to http://tecfa.unige.ch/guides/xml/cocoon/dynamic-xslt/ .  I
> have tried to use the code in my site and have had unpredictable results.
> Here is the xsl used in the example to do the dynamic selection:
>
> <?xml version="1.0" encoding="ISO-8859-1" ?>
> - <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
>   <xsl:param name="portal" />
> - <xsl:template match="page">
>   <xsl:processing-instruction
> name="cocoon-process">type="xslt"</xsl:processing-instruction>
> - <xsl:processing-instruction name="xml-stylesheet">
>   href="
> - <xsl:choose>
>   <xsl:when test="$portal='hip'">hip.xsl</xsl:when>
>   <xsl:when test="$portal='hop'">hop.xsl</xsl:when>
>   <xsl:otherwise>error.xsl</xsl:otherwise>
>   </xsl:choose>
>   " type="text/xsl"
>   </xsl:processing-instruction>
> - <xsl:copy>
>   <xsl:apply-templates select="@*" />
>   <xsl:apply-templates select="node()" />
>   </xsl:copy>
>   </xsl:template>
> - <xsl:template match="*|@*">
> - <xsl:copy>
>   <xsl:apply-templates select="@*" />
>   </xsl:copy>
>   </xsl:template>
>   </xsl:stylesheet>
>
>
> Although the code works great with the example files, when I switch to my
> own pages. I get unpredictable results.  Does anyone have any example code
> or ideas on how to do this?  Can you do it with XSP?
>
>
>
>
>
>
>
>
>
> ---------------------------------------------------------------------
> Please check that your question has not already been answered in the
> FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
>
> To unsubscribe, e-mail: <cocoon-users-unsubscribe@xml.apache.org>
> For additional commands, e-mail: <cocoon-users-help@xml.apache.org>
>


Mime
View raw message