cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "John Menke" <j...@eagleinfosystems.com>
Subject Dynamic selection of stylesheets
Date Thu, 08 Feb 2001 23:58:50 GMT
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?









Mime
View raw message