You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@forrest.apache.org by Erik Stunkat <er...@stunkat.de> on 2006/07/27 09:51:17 UTC
DirectoryGenerator and href to content
Hello,
I have something like:
xdocs/books/moderntrends/
/book1/
- pdf file
- pdf file
/book2/
- pdf file
- pdf file
etc
what I want:
show the pdf files when I go to http://blablabla../books/moderntrends/book1
and link to those files
my sitemap:
<map:pipeline>
<map:match pattern="books/moderntrends/**" type="wildcard">
<map:generate type="directory"
src="{project:content.xdocs}/books/moderntrends/{1}/">
<map:parameter name="depth" value="8"/>
<map:parameter name="sort" value="directory"/>
<map:parameter name="include" value="^({1})"/>
</map:generate>
<map:transform type="xslt" src="{project:resources.stylesheets}dir2.xsl"/>
<map:serialize type="html"/>
</map:match>
</map:pipeline>
my stylesheet:
<xsl:template match="dir:directory|dir:file">
<li>
<xsl:value-of select="@name"/>
<xsl:if test="name(.)='dir:directory'">
<!-- creating subdirectories -->
<ul><xsl:apply-templates/></ul>
</xsl:if>
<xsl:for-each select="@name">
<a href="{generate-id(.)}">
<xsl:value-of select="."/>
</a>
</xsl:for-each>
</li>
</xsl:template>
<xsl:template match="/dir:directory">
<ul>
<xsl:value-of select="@name"/>
<!-- creating subdirectories -->
<xsl:apply-templates/>
</ul>
</xsl:template>
this works for http://blablabla../books/moderntrends/
not for http://blablabla../books/moderntrends/book1
also I get something like:
<li>
487-Infection_of_Mouse.pdf
<a href="N10D95">487-Infection_of_Mouse.pdf</a>
</li>
?
<li>
491-Cocultivation_as_a.pdf
<a href="N10D9A">491-Cocultivation_as_a.pdf</a>
</li>
the href shows something wrong.
any ideas?
thanks
erik stunkat
Re: DirectoryGenerator and href to content
Posted by Tim Williams <wi...@gmail.com>.
On 7/27/06, Erik Stunkat <er...@stunkat.de> wrote:
> Hello,
>
> I have something like:
>
> xdocs/books/moderntrends/
> /book1/
> - pdf file
> - pdf file
> /book2/
> - pdf file
> - pdf file
>
> etc
>
> what I want:
> show the pdf files when I go to http://blablabla../books/moderntrends/book1
>
> and link to those files
>
> my sitemap:
>
> <map:pipeline>
> <map:match pattern="books/moderntrends/**" type="wildcard">
> <map:generate type="directory"
> src="{project:content.xdocs}/books/moderntrends/{1}/">
> <map:parameter name="depth" value="8"/>
> <map:parameter name="sort" value="directory"/>
> <map:parameter name="include" value="^({1})"/>
> </map:generate>
> <map:transform type="xslt" src="{project:resources.stylesheets}dir2.xsl"/>
> <map:serialize type="html"/>
> </map:match>
> </map:pipeline>
>
> my stylesheet:
>
> <xsl:template match="dir:directory|dir:file">
> <li>
> <xsl:value-of select="@name"/>
> <xsl:if test="name(.)='dir:directory'">
> <!-- creating subdirectories -->
> <ul><xsl:apply-templates/></ul>
>
> </xsl:if>
> <xsl:for-each select="@name">
> <a href="{generate-id(.)}">
> <xsl:value-of select="."/>
> </a>
> </xsl:for-each>
> </li>
> </xsl:template>
>
> <xsl:template match="/dir:directory">
> <ul>
> <xsl:value-of select="@name"/>
> <!-- creating subdirectories -->
> <xsl:apply-templates/>
> </ul>
> </xsl:template>
>
>
>
>
> this works for http://blablabla../books/moderntrends/
>
> not for http://blablabla../books/moderntrends/book1
>
>
> also I get something like:
>
> <li>
> 487-Infection_of_Mouse.pdf
> <a href="N10D95">487-Infection_of_Mouse.pdf</a>
> </li>
> ?
> <li>
> 491-Cocultivation_as_a.pdf
> <a href="N10D9A">491-Cocultivation_as_a.pdf</a>
> </li>
>
> the href shows something wrong.
>
> any ideas?
> thanks
> erik stunkat
I don't have a really good appreciation for what you're trying to do
as your stylesheet seems to be off from your description above. But I
think you should look at your regular expression for the "include"
parameter of the generator. To see if that might be the issue, take
the param out and see what you get.
--tim