Subject: Re: [xsl] Template mode value from param From: Martynas Jusevicius <martynas.jusevicius@xxxxxxxxx> Date: Wed, 21 Sep 2011 15:41:51 +0200 |
Hey all, by looking at this situation from another angle I realized that we actually have sioc:Forum elements that can be used for match in the intermediary layout template instead rdf:RDF. So now it looks like this: default.xsl <section id="content"> <xsl:apply-templates/> </section> comic_strips.xsl: <xsl:template match="sioc:Forum[contains(@rdf:about, 'striben')] | *[rdf:type/@rdf:resource = '&sioc;Forum'][contains(@rdf:about, 'striben')]"> <xsl:apply-templates select="key('resources-by-type', '&hn;StripPost')"/> <div> <!-- some content/navigation here --> </div> </xsl:template> Much more simple and generic - and it works :) On Wed, Sep 21, 2011 at 3:09 PM, Andrew Welch <andrew.j.welch@xxxxxxxxx> wrote: >> <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 , Andrew Welch | Thread | [xsl] format-number troubles, Szabo, Patrick \(LNG |
Re: [xsl] Template mode value from , Andrew Welch | Date | [xsl] Saxon CE, result-document and, Tom T |
Month |