You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-user@tomcat.apache.org by Stefan Trcko <st...@aladin-eng.si> on 2003/11/06 15:56:09 UTC

XSL, XML and JSP

Hello

I have an XML file with content listed below:

- <dan datum="2003-11-06">
- <spored kino="Planet Tus Celje">
- <film id="282" language="sl">
  <naslov_si>Ameriska pita: poroka</naslov_si> 
  <naslov_en>American Pie 2</naslov_en> 
  <zvrst>Komedija</zvrst> 
  <url>http://www.planet-tus.com/film.php?id=282</url> 
- <predstava>
  <ura cena="900">15:30</ura> 
  <ura cena="900">18:40</ura> 
  <ura cena="900">20:50</ura> 
  </predstava>
  </film>
</spored>
</dan>
 <dan datum="2003-11-07">
- <spored kino="Planet Tus Celje">
- <film id="282" language="sl">
  <naslov_si>Ameriska pita: poroka</naslov_si> 
  <naslov_en>American Pie 2</naslov_en> 
  <zvrst>Komedija</zvrst> 
  <url>http://www.planet-tus.com/film.php?id=282</url> 
- <predstava>
  <ura cena="900">15:30</ura> 
  <ura cena="900">18:40</ura> 
  <ura cena="900">20:50</ura> 
  <ura cena="900">23:00</ura> 
  </predstava>
  </film>
</spored>
</dan>

This XML I format with XSLT taglib (<xsltlib:style xml="url of the XML file" xsl="XSL file"/>).

Is it possilble to pass parameter to the XSL to get entries only for the specific date for example 2003-11-06 (in the XML file there are entries for one week)?

Thanks,
Stefan

Re: comparing dates

Posted by Kris Schneider <kr...@dotech.com>.
java.util.Date exposes a bean property called "time" of type long. So, you could do:

<c:if test="${date1.time ge date2.time}">
  ...
</c:if>

Quoting Stefan Trcko <st...@aladin-eng.si>:

> Hello
> 
> I want to display data for the dates that are greater or equals curret date.
> This is my code:
> <jsp:useBean id="today_notformated" class="java.util.Date"/>
> 
> <fmt:formatDate var="today" value="${today_notformated}"
> pattern="yyyy-MM-dd"/>
> 
> <c:set var="datum"><x:out select="@datum"/></c:set>
> 
> <fmt:parseDate var="datumDate" value="${datum}" pattern="yyyy-MM-dd"/> 
> 
> <x:choose>
> 
> <fmt:formatDate value="${datumDate}" pattern="yyyy-MM-dd" var="dd"/>
> 
> <x:when select="$dd>=$today">
> 
> .....etc.....
> 
> If I put = the data for current date is displayed. But I want equal or
> greater dates to be displayed.
> 
> Any suggestions?
> 
> Regards,
> 
> Stefan

-- 
Kris Schneider <ma...@dotech.com>
D.O.Tech       <http://www.dotech.com/>

---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


comparing dates

Posted by Stefan Trcko <st...@aladin-eng.si>.
Hello

I want to display data for the dates that are greater or equals curret date. This is my code:
<jsp:useBean id="today_notformated" class="java.util.Date"/>

<fmt:formatDate var="today" value="${today_notformated}" pattern="yyyy-MM-dd"/>

<c:set var="datum"><x:out select="@datum"/></c:set>

<fmt:parseDate var="datumDate" value="${datum}" pattern="yyyy-MM-dd"/> 

<x:choose>

<fmt:formatDate value="${datumDate}" pattern="yyyy-MM-dd" var="dd"/>

<x:when select="$dd>=$today">

.....etc.....

If I put = the data for current date is displayed. But I want equal or greater dates to be displayed.

Any suggestions?

Regards,

Stefan

Re: formating date

Posted by Kris Schneider <kr...@dotech.com>.
You're welcome.

Quoting Stefan Trcko <st...@aladin-eng.si>:

> Thanks again Kris.

-- 
Kris Schneider <ma...@dotech.com>
D.O.Tech       <http://www.dotech.com/>

---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


Re: formating date

Posted by Stefan Trcko <st...@aladin-eng.si>.
Thanks again Kris.

----- Original Message ----- 
From: "Kris Schneider" <kr...@dotech.com>
To: "Tag Libraries Users List" <ta...@jakarta.apache.org>
Sent: Wednesday, November 12, 2003 1:31 PM
Subject: Re: formating date


> I guess you could try the string taglib:
>
> <%@ taglib prefix="string"
>            uri="http://jakarta.apache.org/taglibs/string-1.0.1" %>
> ...
> <string:lowerCase>
> <fmt:formatDate value="${datumDate}" pattern="EEEE, dd.MM.yyyy"/>
> </string:lowerCase>
>
> Quoting Stefan Trcko <st...@aladin-eng.si>:
>
> > Thanks Kris, it's working.
> >
> > One more question:
> >
> > If I write:
> > <c:set var="datum"><x:out select="@datum"/></c:set>
> >
> > <fmt:parseDate var="datumDate" value="${datum}" pattern="yyyy-MM-dd"/>
> >
> > <fmt:formatDate value="${datumDate}" pattern="EEEE, dd.MM.yyyy"
> > var="datum_f1"/>
> >
> > the output is for example: Wednesday, 12.11.2003.
> >
> > How to lowercase this output like wednesday, 12.11.2003?
> >
> >
> > Thanks,
> > Stefan
> >
> >
> >
> > ----- Original Message ----- 
> > From: "Kris Schneider" <kr...@dotech.com>
> > To: "Tag Libraries Users List" <ta...@jakarta.apache.org>
> > Sent: Tuesday, November 11, 2003 10:08 PM
> > Subject: Re: formating date
> >
> >
> > > Or this:
> > >
> > > <x:forEach select="$xml//dan">
> > >   <fmt:parseDate var="datumDate" pattern="yyyy-MM-dd">
> > >     <x:out select="@datum"/>
> > >   </fmt:parseDate>
> > >   <fmt:formatDate value="${datumDate}" pattern="EE, dd.MM.yyyy"/>
> > > </x:forEach>
> > >
> > > Quoting Kris Schneider <kr...@dotech.com>:
> > >
> > > > <x:forEach select="$xml2//dan">
> > > >   <c:set var="datum"><x:out select="@datum"/></c:set>
> > > >   <fmt:parseDate var="datumDate" value="${datum}"
> > pattern="yyyy-MM-dd"/>
> > > >   <fmt:formatDate value="${datumDate}" pattern="EE, dd.MM.yyyy"/>
> > > > <x:forEach>
> > > >
> > > > Quoting Stefan Trcko <st...@aladin-eng.si>:
> > > >
> > > > > I have XML file like this:
> > > > >
> > > > > <dan datum="2003-11-06">
> > > > > ...
> > > > > </dan>
> > > > > <dan datum="2003-11-06">
> > > > > ...
> > > > > </dan>
> > > > >
> > > > > I want to format "datum" to be displayed in format "EE,
dd.MM.yyyy".
> > > > >
> > > > > This is my jsp file:
> > > > > <%@ taglib prefix="fmt" uri="/WEB-INF/tlds/fmt.tld" %>
> > > > >
> > > > > <%@ taglib prefix="x" uri="/WEB-INF/tlds/x.tld" %>
> > > > >
> > > > > <%@ taglib prefix="c" uri="/WEB-INF/tlds/c.tld" %>
> > > > >
> > > > > <c:import url="http://localhost:8083/TestWEB/spored.xml"
var="xml1"
> > > > > charEncoding="iso-8859-2"/>
> > > > >
> > > > > <x:parse var="xml2" xml="${xml1}" />
> > > > >
> > > > > <x:forEach select="$xml2//dan">
> > > > >
> > > > > <x:set var="d1" select="@datum"></x:set>
> > > > > <fmt:formatDate var="d2" value="${d1}" pattern="EE, dd.MM.yyyy"/>
> > > > >
> > > > > </x:forEach>
> > > > >
> > > > > When I run this code I got an error:
> > > > >
> > > > > javax.servlet.jsp.JspException: An error occurred while evaluating
> > custom
> > > > > action attribute "value" with value "${d1}": Attempt to coerce a
value
> > of
> > > > > type "java.util.ArrayList" to type "java.util.Date" (null)
> > > > >
> > > > > Any suggestion?
> > > > >
> > > > > Regards,
> > > > >
> > > > > Stefan
> > > >
> > > > -- 
> > > > Kris Schneider <ma...@dotech.com>
> > > > D.O.Tech       <http://www.dotech.com/>
> > >
> > > -- 
> > > Kris Schneider <ma...@dotech.com>
> > > D.O.Tech       <http://www.dotech.com/>
>
> -- 
> Kris Schneider <ma...@dotech.com>
> D.O.Tech       <http://www.dotech.com/>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: taglibs-user-help@jakarta.apache.org
>




---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


Re: formating date

Posted by Kris Schneider <kr...@dotech.com>.
I guess you could try the string taglib:

<%@ taglib prefix="string"
           uri="http://jakarta.apache.org/taglibs/string-1.0.1" %>
...
<string:lowerCase>
<fmt:formatDate value="${datumDate}" pattern="EEEE, dd.MM.yyyy"/>
</string:lowerCase>

Quoting Stefan Trcko <st...@aladin-eng.si>:

> Thanks Kris, it's working.
> 
> One more question: 
> 
> If I write:
> <c:set var="datum"><x:out select="@datum"/></c:set>
> 
> <fmt:parseDate var="datumDate" value="${datum}" pattern="yyyy-MM-dd"/>
> 
> <fmt:formatDate value="${datumDate}" pattern="EEEE, dd.MM.yyyy"
> var="datum_f1"/>
> 
> the output is for example: Wednesday, 12.11.2003. 
> 
> How to lowercase this output like wednesday, 12.11.2003?
> 
> 
> Thanks,
> Stefan
> 
> 
> 
> ----- Original Message ----- 
> From: "Kris Schneider" <kr...@dotech.com>
> To: "Tag Libraries Users List" <ta...@jakarta.apache.org>
> Sent: Tuesday, November 11, 2003 10:08 PM
> Subject: Re: formating date
> 
> 
> > Or this:
> > 
> > <x:forEach select="$xml//dan">
> >   <fmt:parseDate var="datumDate" pattern="yyyy-MM-dd">
> >     <x:out select="@datum"/>
> >   </fmt:parseDate>
> >   <fmt:formatDate value="${datumDate}" pattern="EE, dd.MM.yyyy"/>
> > </x:forEach>
> > 
> > Quoting Kris Schneider <kr...@dotech.com>:
> > 
> > > <x:forEach select="$xml2//dan">
> > >   <c:set var="datum"><x:out select="@datum"/></c:set>
> > >   <fmt:parseDate var="datumDate" value="${datum}"
> pattern="yyyy-MM-dd"/>
> > >   <fmt:formatDate value="${datumDate}" pattern="EE, dd.MM.yyyy"/>
> > > <x:forEach>
> > > 
> > > Quoting Stefan Trcko <st...@aladin-eng.si>:
> > > 
> > > > I have XML file like this:
> > > > 
> > > > <dan datum="2003-11-06">
> > > > ...
> > > > </dan>
> > > > <dan datum="2003-11-06">
> > > > ...
> > > > </dan>
> > > > 
> > > > I want to format "datum" to be displayed in format "EE, dd.MM.yyyy".
> > > > 
> > > > This is my jsp file:
> > > > <%@ taglib prefix="fmt" uri="/WEB-INF/tlds/fmt.tld" %>
> > > > 
> > > > <%@ taglib prefix="x" uri="/WEB-INF/tlds/x.tld" %>
> > > > 
> > > > <%@ taglib prefix="c" uri="/WEB-INF/tlds/c.tld" %>
> > > > 
> > > > <c:import url="http://localhost:8083/TestWEB/spored.xml" var="xml1"
> > > > charEncoding="iso-8859-2"/>
> > > > 
> > > > <x:parse var="xml2" xml="${xml1}" />
> > > > 
> > > > <x:forEach select="$xml2//dan">
> > > > 
> > > > <x:set var="d1" select="@datum"></x:set>
> > > > <fmt:formatDate var="d2" value="${d1}" pattern="EE, dd.MM.yyyy"/>
> > > > 
> > > > </x:forEach>
> > > > 
> > > > When I run this code I got an error:
> > > > 
> > > > javax.servlet.jsp.JspException: An error occurred while evaluating
> custom
> > > > action attribute "value" with value "${d1}": Attempt to coerce a value
> of
> > > > type "java.util.ArrayList" to type "java.util.Date" (null)
> > > > 
> > > > Any suggestion?
> > > > 
> > > > Regards,
> > > > 
> > > > Stefan
> > > 
> > > -- 
> > > Kris Schneider <ma...@dotech.com>
> > > D.O.Tech       <http://www.dotech.com/>
> > 
> > -- 
> > Kris Schneider <ma...@dotech.com>
> > D.O.Tech       <http://www.dotech.com/>

-- 
Kris Schneider <ma...@dotech.com>
D.O.Tech       <http://www.dotech.com/>

---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


Re: formating date

Posted by Stefan Trcko <st...@aladin-eng.si>.
Thanks Kris, it's working.

One more question: 

If I write:
<c:set var="datum"><x:out select="@datum"/></c:set>

<fmt:parseDate var="datumDate" value="${datum}" pattern="yyyy-MM-dd"/>

<fmt:formatDate value="${datumDate}" pattern="EEEE, dd.MM.yyyy" var="datum_f1"/>

the output is for example: Wednesday, 12.11.2003. 

How to lowercase this output like wednesday, 12.11.2003?


Thanks,
Stefan



----- Original Message ----- 
From: "Kris Schneider" <kr...@dotech.com>
To: "Tag Libraries Users List" <ta...@jakarta.apache.org>
Sent: Tuesday, November 11, 2003 10:08 PM
Subject: Re: formating date


> Or this:
> 
> <x:forEach select="$xml//dan">
>   <fmt:parseDate var="datumDate" pattern="yyyy-MM-dd">
>     <x:out select="@datum"/>
>   </fmt:parseDate>
>   <fmt:formatDate value="${datumDate}" pattern="EE, dd.MM.yyyy"/>
> </x:forEach>
> 
> Quoting Kris Schneider <kr...@dotech.com>:
> 
> > <x:forEach select="$xml2//dan">
> >   <c:set var="datum"><x:out select="@datum"/></c:set>
> >   <fmt:parseDate var="datumDate" value="${datum}" pattern="yyyy-MM-dd"/>
> >   <fmt:formatDate value="${datumDate}" pattern="EE, dd.MM.yyyy"/>
> > <x:forEach>
> > 
> > Quoting Stefan Trcko <st...@aladin-eng.si>:
> > 
> > > I have XML file like this:
> > > 
> > > <dan datum="2003-11-06">
> > > ...
> > > </dan>
> > > <dan datum="2003-11-06">
> > > ...
> > > </dan>
> > > 
> > > I want to format "datum" to be displayed in format "EE, dd.MM.yyyy".
> > > 
> > > This is my jsp file:
> > > <%@ taglib prefix="fmt" uri="/WEB-INF/tlds/fmt.tld" %>
> > > 
> > > <%@ taglib prefix="x" uri="/WEB-INF/tlds/x.tld" %>
> > > 
> > > <%@ taglib prefix="c" uri="/WEB-INF/tlds/c.tld" %>
> > > 
> > > <c:import url="http://localhost:8083/TestWEB/spored.xml" var="xml1"
> > > charEncoding="iso-8859-2"/>
> > > 
> > > <x:parse var="xml2" xml="${xml1}" />
> > > 
> > > <x:forEach select="$xml2//dan">
> > > 
> > > <x:set var="d1" select="@datum"></x:set>
> > > <fmt:formatDate var="d2" value="${d1}" pattern="EE, dd.MM.yyyy"/>
> > > 
> > > </x:forEach>
> > > 
> > > When I run this code I got an error:
> > > 
> > > javax.servlet.jsp.JspException: An error occurred while evaluating custom
> > > action attribute "value" with value "${d1}": Attempt to coerce a value of
> > > type "java.util.ArrayList" to type "java.util.Date" (null)
> > > 
> > > Any suggestion?
> > > 
> > > Regards,
> > > 
> > > Stefan
> > 
> > -- 
> > Kris Schneider <ma...@dotech.com>
> > D.O.Tech       <http://www.dotech.com/>
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: taglibs-user-help@jakarta.apache.org
> > 
> 
> 
> -- 
> Kris Schneider <ma...@dotech.com>
> D.O.Tech       <http://www.dotech.com/>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: taglibs-user-help@jakarta.apache.org
> 
> 

Re: formating date

Posted by Kris Schneider <kr...@dotech.com>.
Or this:

<x:forEach select="$xml//dan">
  <fmt:parseDate var="datumDate" pattern="yyyy-MM-dd">
    <x:out select="@datum"/>
  </fmt:parseDate>
  <fmt:formatDate value="${datumDate}" pattern="EE, dd.MM.yyyy"/>
</x:forEach>

Quoting Kris Schneider <kr...@dotech.com>:

> <x:forEach select="$xml2//dan">
>   <c:set var="datum"><x:out select="@datum"/></c:set>
>   <fmt:parseDate var="datumDate" value="${datum}" pattern="yyyy-MM-dd"/>
>   <fmt:formatDate value="${datumDate}" pattern="EE, dd.MM.yyyy"/>
> <x:forEach>
> 
> Quoting Stefan Trcko <st...@aladin-eng.si>:
> 
> > I have XML file like this:
> > 
> > <dan datum="2003-11-06">
> > ...
> > </dan>
> > <dan datum="2003-11-06">
> > ...
> > </dan>
> > 
> > I want to format "datum" to be displayed in format "EE, dd.MM.yyyy".
> > 
> > This is my jsp file:
> > <%@ taglib prefix="fmt" uri="/WEB-INF/tlds/fmt.tld" %>
> > 
> > <%@ taglib prefix="x" uri="/WEB-INF/tlds/x.tld" %>
> > 
> > <%@ taglib prefix="c" uri="/WEB-INF/tlds/c.tld" %>
> > 
> > <c:import url="http://localhost:8083/TestWEB/spored.xml" var="xml1"
> > charEncoding="iso-8859-2"/>
> > 
> > <x:parse var="xml2" xml="${xml1}" />
> > 
> > <x:forEach select="$xml2//dan">
> > 
> > <x:set var="d1" select="@datum"></x:set>
> > <fmt:formatDate var="d2" value="${d1}" pattern="EE, dd.MM.yyyy"/>
> > 
> > </x:forEach>
> > 
> > When I run this code I got an error:
> > 
> > javax.servlet.jsp.JspException: An error occurred while evaluating custom
> > action attribute "value" with value "${d1}": Attempt to coerce a value of
> > type "java.util.ArrayList" to type "java.util.Date" (null)
> > 
> > Any suggestion?
> > 
> > Regards,
> > 
> > Stefan
> 
> -- 
> Kris Schneider <ma...@dotech.com>
> D.O.Tech       <http://www.dotech.com/>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: taglibs-user-help@jakarta.apache.org
> 


-- 
Kris Schneider <ma...@dotech.com>
D.O.Tech       <http://www.dotech.com/>

---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


Re: formating date

Posted by Kris Schneider <kr...@dotech.com>.
<x:forEach select="$xml2//dan">
  <c:set var="datum"><x:out select="@datum"/></c:set>
  <fmt:parseDate var="datumDate" value="${datum}" pattern="yyyy-MM-dd"/>
  <fmt:formatDate value="${datumDate}" pattern="EE, dd.MM.yyyy"/>
<x:forEach>

Quoting Stefan Trcko <st...@aladin-eng.si>:

> I have XML file like this:
> 
> <dan datum="2003-11-06">
> ...
> </dan>
> <dan datum="2003-11-06">
> ...
> </dan>
> 
> I want to format "datum" to be displayed in format "EE, dd.MM.yyyy".
> 
> This is my jsp file:
> <%@ taglib prefix="fmt" uri="/WEB-INF/tlds/fmt.tld" %>
> 
> <%@ taglib prefix="x" uri="/WEB-INF/tlds/x.tld" %>
> 
> <%@ taglib prefix="c" uri="/WEB-INF/tlds/c.tld" %>
> 
> <c:import url="http://localhost:8083/TestWEB/spored.xml" var="xml1"
> charEncoding="iso-8859-2"/>
> 
> <x:parse var="xml2" xml="${xml1}" />
> 
> <x:forEach select="$xml2//dan">
> 
> <x:set var="d1" select="@datum"></x:set>
> <fmt:formatDate var="d2" value="${d1}" pattern="EE, dd.MM.yyyy"/>
> 
> </x:forEach>
> 
> When I run this code I got an error:
> 
> javax.servlet.jsp.JspException: An error occurred while evaluating custom
> action attribute "value" with value "${d1}": Attempt to coerce a value of
> type "java.util.ArrayList" to type "java.util.Date" (null)
> 
> Any suggestion?
> 
> Regards,
> 
> Stefan

-- 
Kris Schneider <ma...@dotech.com>
D.O.Tech       <http://www.dotech.com/>

---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


formating date

Posted by Stefan Trcko <st...@aladin-eng.si>.
I have XML file like this:

<dan datum="2003-11-06">
...
</dan>
<dan datum="2003-11-06">
...
</dan>

I want to format "datum" to be displayed in format "EE, dd.MM.yyyy".

This is my jsp file:
<%@ taglib prefix="fmt" uri="/WEB-INF/tlds/fmt.tld" %>

<%@ taglib prefix="x" uri="/WEB-INF/tlds/x.tld" %>

<%@ taglib prefix="c" uri="/WEB-INF/tlds/c.tld" %>

<c:import url="http://localhost:8083/TestWEB/spored.xml" var="xml1" charEncoding="iso-8859-2"/>

<x:parse var="xml2" xml="${xml1}" />

<x:forEach select="$xml2//dan">

<x:set var="d1" select="@datum"></x:set>
<fmt:formatDate var="d2" value="${d1}" pattern="EE, dd.MM.yyyy"/>

</x:forEach>

When I run this code I got an error:

javax.servlet.jsp.JspException: An error occurred while evaluating custom action attribute "value" with value "${d1}": Attempt to coerce a value of type "java.util.ArrayList" to type "java.util.Date" (null)

Any suggestion?

Regards,

Stefan







Re: xsl:when

Posted by Kris Schneider <kr...@dotech.com>.
This should work:

<%@ page contentType="text/plain" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt" %>
<%@ taglib prefix="x"   uri="http://java.sun.com/jstl/xml" %>

<x:parse var="xml">
  <!-- XML here -->
</x:parse>

<jsp:useBean id="today_notformated" class="java.util.Date"/>
<fmt:formatDate var="today"
                value="${today_notformated}"
                pattern="yyyy-MM-dd"/>

<x:forEach select="$xml//dan[@datum=$today]">
    <x:out select="./@datum"/>
</x:forEach>

Which should give:

2003-11-07

Quoting Stefan Trcko <st...@aladin-eng.si>:

> Hello
> 
> I have an XML file with content listed below:
> 
> - <dan datum="2003-11-06">
> - <spored kino="Planet Tus Celje">
> - <film id="282" language="sl">
>   <naslov_si>Ameriska pita: poroka</naslov_si> 
>   <naslov_en>American Pie 2</naslov_en> 
>   <zvrst>Komedija</zvrst> 
>   <url>http://www.planet-tus.com/film.php?id=282</url> 
> - <predstava>
>   <ura cena="900">15:30</ura> 
>   <ura cena="900">18:40</ura> 
>   <ura cena="900">20:50</ura> 
>   </predstava>
>   </film>
> </spored>
> </dan>
>  <dan datum="2003-11-07">
> - <spored kino="Planet Tus Celje">
> - <film id="282" language="sl">
>   <naslov_si>Ameriska pita: poroka</naslov_si> 
>   <naslov_en>American Pie 2</naslov_en> 
>   <zvrst>Komedija</zvrst> 
>   <url>http://www.planet-tus.com/film.php?id=282</url> 
> - <predstava>
>   <ura cena="900">15:30</ura> 
>   <ura cena="900">18:40</ura> 
>   <ura cena="900">20:50</ura> 
>   <ura cena="900">23:00</ura> 
>   </predstava>
>   </film>
> </spored>
> </dan>
> 
> This is mys jsp file:
> <%
> 
> Datum datum = new Datum(); 
> 
> Date today_notformated = new Date();
> 
> String today = datum.formatiraj_datum(danasnjiDatum,"yyyy-MM-dd");
> 
> <!--today_notformated is formated to year-month-day-->
> 
> %>
> 
> <tl:forEach select="//dan">
> 
> <tl:choose>
> 
> <tl:when test="@datum=$today">
> 
> <TR>
> 
> <TD>
> 
> <tl:valueOf select="@datum"/>
> 
> </TD>
> 
> </TR>
> 
> .....
> 
> I want to print out only the data for the current date, but when I test
> <tl:when test="@datum=$today">, the test doesn't work.
> Any suggestions?
> 
> Thanks,
> Stefan

-- 
Kris Schneider <ma...@dotech.com>
D.O.Tech       <http://www.dotech.com/>

---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


xsl:when

Posted by Stefan Trcko <st...@aladin-eng.si>.
Hello

I have an XML file with content listed below:

- <dan datum="2003-11-06">
- <spored kino="Planet Tus Celje">
- <film id="282" language="sl">
  <naslov_si>Ameriska pita: poroka</naslov_si> 
  <naslov_en>American Pie 2</naslov_en> 
  <zvrst>Komedija</zvrst> 
  <url>http://www.planet-tus.com/film.php?id=282</url> 
- <predstava>
  <ura cena="900">15:30</ura> 
  <ura cena="900">18:40</ura> 
  <ura cena="900">20:50</ura> 
  </predstava>
  </film>
</spored>
</dan>
 <dan datum="2003-11-07">
- <spored kino="Planet Tus Celje">
- <film id="282" language="sl">
  <naslov_si>Ameriska pita: poroka</naslov_si> 
  <naslov_en>American Pie 2</naslov_en> 
  <zvrst>Komedija</zvrst> 
  <url>http://www.planet-tus.com/film.php?id=282</url> 
- <predstava>
  <ura cena="900">15:30</ura> 
  <ura cena="900">18:40</ura> 
  <ura cena="900">20:50</ura> 
  <ura cena="900">23:00</ura> 
  </predstava>
  </film>
</spored>
</dan>

This is mys jsp file:
<%

Datum datum = new Datum(); 

Date today_notformated = new Date();

String today = datum.formatiraj_datum(danasnjiDatum,"yyyy-MM-dd");

<!--today_notformated is formated to year-month-day-->

%>

<tl:forEach select="//dan">

<tl:choose>

<tl:when test="@datum=$today">

<TR>

<TD>

<tl:valueOf select="@datum"/>

</TD>

</TR>

.....

I want to print out only the data for the current date, but when I test <tl:when test="@datum=$today">, the test doesn't work.
Any suggestions?

Thanks,
Stefan