Subject: Re: [xsl] Template mode value from param From: Andrew Welch <andrew.j.welch@xxxxxxxxx> Date: Wed, 21 Sep 2011 14:09:36 +0100 |
> <xsl:import href="comic_strips.xsl"/> > <xsl:param name="view"/> > > <xsl:template match="/"> > <html> > <head>...</head> > <body> > <!-- header goes here --> > <!-- insert main content here --> > <section id="content"> > <xsl:choose> > <xsl:when test="$view = '&hn;FrontPageView'"> > <xsl:apply-templates select="rdf:RDF" mode="hn:FrontPageView"/> > </xsl:when> > <!-- more cases here --> At somepoint you will need the logic to based on the $view param, so you can either do it like you have, or create a new entry point stylesheet called FrontPageView.xslt that just applies templates in that mode, and move the logic into whatever is calling the transform to use the new entry point. To do that you need to rewrite your existing template a little to accept the mode and pass it on (using #all and #current): <xsl:template match="/rdf:RDF" mode="#all"> <html> <head>...</head> <body> <!-- header goes here --> <!-- insert main content here --> <section id="content"> <xsl:choose> <xsl:when test="$view = '&hn;FrontPageView'"> <xsl:apply-templates select="." mode="#current"/> and then in the new entry point stylesheet: <xsl:template match="/"> <xsl:apply-templates select="rdf:RDF" mode="hn:FrontPageView"/> </ -- Andrew Welch http://andrewjwelch.com
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Template mode value from , Martynas Jusevicius | Thread | Re: [xsl] Template mode value from , Martynas Jusevicius |
Re: [xsl] Template mode value from , Martynas Jusevicius | Date | Re: [xsl] Template mode value from , Martynas Jusevicius |
Month |