cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cparp...@t-online.de (Christian Parpart)
Subject RE: Cocoon
Date Sat, 06 Jan 2001 12:14:55 GMT
Hi,

this is my code to get the .xml file's lastModified date.
[---------------------
  <xsl:template match="document/spec">
    <spec>
      <document-filename><xsl:value-of
select="$filename"/></document-filename>
      <xsp:logic>
        String _u = new String(<request:get-request-uri/>);
        <xsp:content>
          <last-modified>
            <xsp:expr>(new Date((new
File(_u)).lastModified())).toString()</xsp:expr></last-modified>
        </xsp:content>
      </xsp:logic>
      <xsl:apply-templates/>
    </spec>
  </xsl:template>
---------------------]

this doesn't work for <request:get-request-uri/>,
because it is only the request path and the File object
need the absolute path or a right working relative one.

If I use <xsl:value-of select="$filename"/> instead,
the File object would get the absolute path.

But unfortunatly, I am using here Win2k and the path
seperator is the '\\' and not '/'.
My example $filename looks like C:\Eigene Dateien\projects\eko\htdocs\gb.xml
and as you can see there're alot of '\\'. But Java
thinks that this is a format character ('\E', '\p', '\e', '\h', '\g')
And there're invalid.
I have to embedd it to:
        String _u = new String("<xsl:value-of select="$filename"/>");
Here I get the above Java-XSP exceptions,
other things doesn't work.

What must I do?
((Normally I am programming with C++,
so I am new in Java, quite less experiences))

Thanks to you all,
Christian Parpart

> -----Urspr√ľngliche Nachricht-----
> Von: jeff@socialchange.net.au [mailto:jeff@socialchange.net.au]
> Gesendet: Samstag, 6. Januar 2001 07:16
> An: cocoon-users@xml.apache.org
> Cc: cparpart@surakware.com
> Betreff: Re: Cocoon
>
>
>
>
> > Hi,
> >
> > Cocoon knows what a .xml files he has to let parse.
> > XSP is from Cocoon.
>
> Cocoon is just a fancy servlet.. it figures out the file
> name from standard HttpServletRequest fields.
>
> >
> > So how can I get the .XML's file name from my XSP
> > code inside.
>
> Here's an example XSP and taglib that illustrate:
>  - getting the XSP name
>  - getting the name of the calling XSP from a taglib
>  - other stuff (XSP-ENVIRONMENT, etc) accessible
>     from the taglib
>
> ---- simple.xml ----
> <?xml version='1.0'?>
> <?cocoon-process type="xsp"?>
> <?xml-logicsheet href="taglib.xsl"?>
> <?cocoon-format type="text/html"?>
>
> <xsp:page language="java"
>   xmlns:xsp="http://www.apache.org/1999/XSP/Core"
>   xmlns:request="http://www.apache.org/1999/XSP/Request"
>   xmlns:taglib="http://www.socialchange.net.au/~jeff/taglib"
> >
> <html>
>     <body>
>         The XSP page (from XSP): <request:get-request-uri/><br />
>         The XSP page (from taglib): <taglib:geturi/><br />
>         Other stuff visible in the taglib:<br />
>         <taglib:otherstuff/>
>
>     </body>
> </html>
>
> </xsp:page>
> --------
>
> ---- taglib.xsl ----
> <?xml version="1.0"?>
> <xsl:stylesheet version="1.0"
>   xmlns:taglib="http://www.socialchange.net.au/~jeff/taglib"
>   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>   xmlns:xsp="http://www.apache.org/1999/XSP/Core">
>
> <xsl:param name="filename"/>
> <xsl:param name="language"/>
> <xsl:param name="XSP-ENVIRONMENT"/>
> <xsl:param name="XSP-VERSION"/>
>
> <xsl:template match="xsp:page">
>     <xsp:page>
>         <xsl:copy>
>             <xsl:apply-templates select="@*" />
>         </xsl:copy>
>         <xsl:apply-templates />
>     </xsp:page>
> </xsl:template>
>
> <xsl:template match="taglib:geturi">
> <xsl:value-of select="$filename"/>
> </xsl:template>
>
> <xsl:template match="taglib:otherstuff">
>     language: <xsl:value-of select="$language"/><br />
>     XSP-ENVIRONMENT: <xsl:value-of select="$XSP-ENVIRONMENT"/><br />
>     XSP-VERSION: <xsl:value-of select="$XSP-VERSION"/><br />
> </xsl:template>
>
> <xsl:template match="@*|node()" priority="-1">
>     <xsl:copy>
>         <xsl:apply-templates select="@*|node()" />
>     </xsl:copy>
> </xsl:template>
>
> </xsl:stylesheet>
> --------
>
>
> --Jeff
>
>
> >
> > Does that anyone know?
> >
> > Thanks in advance,
> >
> > Christian Parpart
> > SurakWare
> > cparpart@surakware.com
> > http://surak.cocoonhost.com
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> > For additional commands, e-mail: cocoon-users-help@xml.apache.org
>
>
> ---------------------------------------------------------------------
> 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