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="[EMAIL PROTECTED]"
> > select=".//forrest:[EMAIL PROTECTED]'{$name}']/forrest:[EMAIL
> > PROTECTED]'[EMAIL PROTECTED]']"/>
> > + <alias:with-param name="[EMAIL PROTECTED]"
> > 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="[EMAIL PROTECTED]" select="'{normalize-space(.)}'"/>
+ <xsl:variable name="xpath">
+ <xsl:value-of select="'/site'"/>
+ <xsl:call-template name="generateXPath"/>
+ </xsl:variable>
+ <alias:with-param name="[EMAIL PROTECTED]"
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)