cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "flourish" <cocoo...@dork.com>
Subject Re: <xsl:param name="filename"/>
Date Mon, 26 Mar 2001 19:46:00 GMT
You could do it much more simply with xsp using the file utility methods
provided by xsp, if you can/are will to run this through xsp at some point.

----- Original Message -----
From: "Peter C. Verhage" <petercv@zeelandnet.nl>
To: <cocoon-users@xml.apache.org>
Sent: Monday, March 26, 2001 2:24 PM
Subject: <xsl:param name="filename"/>


> Is there also something like the above to get only the path, and not the
> filename? I can extract the path of the above using the following XSLT
code:
>
> <xsl:param name="filename"/>
>
> <xsl:template name="get-path">
>   <xsl:param name="file"/>
>   <xsl:param name="path"/>
>   <xsl:choose>
>     <xsl:when test="string-length($file) > 0 and contains($file, '/')">
>       <xsl:call-template name="get-path">
>         <xsl:with-param name="file" select="substring-after($file, '/')"/>
>         <xsl:with-param name="path" select="concat($path,
> substring-before($file, '/'), '/')"/>
>       </xsl:call-template>
>     </xsl:when>
>     <xsl:otherwise>
>       <xsl:value-of select="$path"/>
>     </xsl:otherwise>
>   </xsl:choose>
> </xsl:template>
>
> <xsl:variable name="path">
>   <xsl:call-template name="get-path">
>     <xsl:with-param name="file" select="$filename"/>
>     <xsl:with-param name="path"/>
>   </xsl:call-template>
> </xsl:variable>
>
> But maybe there is a faster way in doing this (btw, this example only
works
> within a Unix like environment, because it uses the '/' instead of the
'\').
>
> Peter
>
>
> ---------------------------------------------------------------------
> Please check that your question has not already been answered in the
> FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
>
> To unsubscribe, e-mail: <cocoon-users-unsubscribe@xml.apache.org>
> For additional commands, e-mail: <cocoon-users-help@xml.apache.org>
>
>


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <cocoon-users-unsubscribe@xml.apache.org>
For additional commands, e-mail: <cocoon-users-help@xml.apache.org>


Mime
View raw message