forrest-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thorsten Scherler <thors...@apache.org>
Subject Re: [Fwd: Re: [views] nugget contracts broken]
Date Mon, 12 Sep 2005 00:10:05 GMT
On Sun, 2005-09-11 at 20:59 +0100, Ross Gardler wrote: 
> Thorsten Scherler wrote:
> > I think no nugget should work. :(
> > svn diff -r225411:HEAD resources/stylesheets/prepare.xhtml.xsl
> > - <alias:with-param name="{@name}"
> > select=".//forrest:properties[@contract='{$name}']/forrest:property[@name='{@name}']"/>
> > + <alias:with-param name="{@name}" select="'{normalize-space(.)}'"/>
> > 
> > This is the problem. Now you cannot pass xml-snippet as param anymore.
> > It is quite complicated to calculate the right xpath expression only in
> > xsl

Actually that is completely untrue what I said here! Sorry!

It is *very easy* to generate an xpath expression in xsl - it is the
nature of xpath that makes it so easy . ;-)

- <alias:with-param name="{@name}" select="'{normalize-space(.)}'"/>
+ <xsl:variable name="xpath">
+  <xsl:value-of select="'/site'"/>
+  <xsl:call-template name="generateXPath"/>
+ </xsl:variable>
+ <alias:with-param name="{@name}" select="{normalize-space($xpath)}"/>
...
+    <xsl:template name="generateXPath">
+      <xsl:for-each select="ancestor::*[name()!='filter']">
+        /<xsl:value-of select="name()"/>[<xsl:number/>]
+      </xsl:for-each>
+      /<xsl:value-of select="name()"/>[<xsl:number/>]
+    </xsl:template> 

I only had a hard time because of the forrest:filter element and its
namespace. The forrest namespace is not defined in the document
aggregation in the sitemap that causes errors in the xpath. So I striped
the ns. ;-)

...

> > I will have a look on how we can fixed that but I guess I will as well
> > look into how to solve that with java.
> 
> I have no suggestion for a solution, however, if it is any consolation I 
> like the idea of moving it into Java since we can add cachng later on 
> (XIncludes can't be cached).

Actually if we use cinclude for the nuggets contracts instead we would
have caching as well. We just need to change that. ;-)

Generally the "magic" part can stay like this till we decided whether we
want to write a generator or a transformer for it. 

I will play with it when I find time.

> It's also good that you found this, because I was having big problems 
> with using nuggets to do the navigation in the XHTML2 plugin. I'd not 
> had time to debug it (hence no ideas yer), but the symptoms sound the same.
> 
> Ross

Please test whether that solves your problem.
http://svn.apache.org/viewcvs?rev=280213&view=rev 

salu2
-- 
thorsten

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


Mime
View raw message