RE: [xsl] dyn:evaluate question

Subject: RE: [xsl] dyn:evaluate question
From: Thorsten Scherler <thorsten@xxxxxxxxxx>
Date: Wed, 23 Mar 2005 14:46:55 +0100
On Wed, 2005-03-23 at 13:19 +0000, Michael Kay wrote:
> We used to get a lot of variations on attempts to do dynamic inclusion, but
> this is one of the most imaginative.
> 

LOL

cheers ;-)

> xsl:include is a compile time construct, it's effect happens right at the
> start of processing, to assemble a stylesheet for compilation. There's no
> way a variable can be evaluated before the stylesheet has been compiled, so
> trying to refer to a variable here simply isn't going to work.
> dyn:evaluate() does things at run-time that would normally be done at
> compile-time, it isn't going to enable you to do at compile time something
> (evaluating a variable) that can only possibly be done at run-time.
> 
> You don't need a workaround, you need a different design: but you haven't
> said what the problem is, so I can't give you one.
> 

I want to implement a per document view. This view extracts html
snippets from a snippet rep. This way user from apache forrest can
implement their own view for each document or use the default view
without knowing xsl. 

sample for a view:
<forrest:view
  xmlns:forrest="http://apache.org/forrest/templates/1.0"; type="xhtml">
  
  <forrest:contract name="meta"/>
  
  <forrest:hook name="container">
    <forrest:hook name="branding">
      <forrest:contract name="projectlogo"/>
      <forrest:contract name="grouplogo"/>
      <forrest:contract name="searchbox"/>
      <forrest:contract name="nav-main"/>
    </forrest:hook>
    <forrest:hook name="spacer" />
    <forrest:contract name="nav"/>
    <forrest:contract name="content"/>
  </forrest:hook>
  <forrest:contract name="feedback"/>
</forrest:view>

pipe:

index.html -> requested page

index.xml -> content for the page
index.fv -> styling information about the page (as forrest:view)

Through the prepare.include.* and prepare.xhmtl.* I am calling html
snippets from a rep based on index.fv. 

On the final stylesheet I am then creating the page like 
<xhtml>
  <head>
    <xsl:call-template name="getHead"/>
    <style type="text/css">
      <xsl:call-template name="getCss"/>
    </style>
  </head>
</xhtml>

cheers for any suggestions
salu2

> Michael Kay
> http://www.saxonica.com/
> 
> 
> 
> > -----Original Message-----
> > From: Thorsten Scherler [mailto:thorsten@xxxxxxxxxx] 
> > Sent: 23 March 2005 13:00
> > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> > Subject: [xsl] dyn:evaluate question
> > 
> > Hello list,
> > 
> > I am trying to dynamically include a stylesheet like this:
> > <xsl:variable name="request">index</xsl:variable>
> > <xsl:include href="cocoon:/prepare.include.dyn:evaluate($request)"/>
> > 
> > but the dyn:evaluate($request) -part will not get resolved.
> > 
> > As soon I change it to 
> > <xsl:include href="cocoon:/prepare.include.index"/>
> > I get my stylesheets.
> > 
> > Am I using the dyn:evaluate wrong? Are there a workaround?
> > 
> > TIA
> > -- 
> > thorsten
> > 
> > "Together we stand, divided we fall!" 
> > Hey you (Pink Floyd)
> 
-- 
thorsten

"Together we stand, divided we fall!" 
Hey you (Pink Floyd)

Current Thread