cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ulrich Mayring <u...@denic.de>
Subject Re: access xml filename
Date Wed, 28 Jun 2000 09:41:02 GMT
Torsten Curdt wrote:
> 
> How can I access the filename of the xml document
> from within the XSL !?

You need to pass it into the stylesheet like
<filename>myxml.xml</filename>, then you can access it via XPath. Thus
you need to find the filename in your XML/XSP page, e.g. like this:

<xsp:logic>
	<filename>
		<xsp:expr>
		
XSPUtil.baseName(XSPUtil.baseName(XSPUtil.fileComponent(normalize(request.getPathInfo()))))
		</xsp:expr>
	</filename>
</xsp:logic>

This is just one of several ways to go about it. I don't remember why I
did it like this, but it worked ages ago. Today you can probably use the
util taglib instead.

You might need to define the method normalize, it does basic
sanity-checking:

if (string == null) return "";
else return string;

Ulrich

-- 
Ulrich Mayring
DENIC eG, Systementwicklung

Mime
View raw message