cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marco Magistrali <magistr...@ariadne.it>
Subject Re: choose xsl stylesheet dinamically
Date Thu, 22 Feb 2001 14:35:51 GMT
ok, but I would like to choose the xsl stylesheet before the tag <xsl:template match="page">
I would like to choose in the declaration....


pierre.brimont@crpht.lu wrote:

> Hi Marco
>
> I don't  know if it's a good solution for you but here it works fine.
>
> My principal stylesheet :
>
> <?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='edit'">page-html.xsl</xsl:when>
>           <xsl:when test="$portal='publi'">page-html-publi.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="*|@*|text()"/>
>     </xsl:copy>
>   </xsl:template>
> </xsl:stylesheet>
>
> -----------------------------------------------------------------------------------------------------
>
> page-html.xsl and page-html-publi.xsl contains the stylesheets i choose
> with the parameter value
> I mean, the url is : http://mysite.com/myfile.xml?portal=edit      (or
> publi)
>  and the header of myfile.xml is :
>
> <?xml version="1.0"?>
> <?cocoon-process type="xslt"?>
> <?xml-stylesheet href="broker.xsl" type="text/xsl"?>
> <page>
>   <author> P. Brimont  </author>
>
> <!-- ....  -->
>
> </page>
>
> If you want more details, check  the earlier artciles of this mailing list.
> The broker.xsl comes from here.
>
> I hope this helps.
> Regards
> Pierre
>
>
>                     Marco
>                     Magistrali           To:     cocoon-users@xml.apache.org
>                     <magistrali@a        cc:
>                     riadne.it>           Subject:     choose xsl stylesheet dinamically
>
>                     22/02/2001
>                     11:25
>                     Please
>                     respond to
>                     cocoon-users
>
>
>
> Hi to everybody,
>
>     is it possible to choose xsl stylesheet like this:
>
> <?xml version='1.0' encoding='UTF-8'?>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> <xsl:include href="../portlets/xsl/griglia.xsl"/>
>
> <xsl:if test=" pippo='yes' ">
> <xsl:include href="../portlets/xsl/toolbar_yes.xsl"/>
> </xsl:if>
>
> <xsl:if test=" pippo='no' ">
> <xsl:include href="../portlets/xsl/toolbar_no.xsl"/>
> </xsl:if>
>
> <xsl:include href="../portlets/xsl/strumenti.xsl"/>
> <xsl:output method="html"/>
>
> <xsl:template match="page">.....
>
> in which pippo is a variable that I put in xml file????
>
> thanks
>
> Marco
>
> ---------------------------------------------------------------------
> 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>
>
> ---------------------------------------------------------------------
> 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