tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stefan Trcko" <stefan.tr...@aladin-eng.si>
Subject Re: taglibs and xsl problem
Date Fri, 09 May 2003 13:28:29 GMT
Hello

I tried your solution <xsl:when test='element-available("event")'>, but its not working.

And also no data is written on the screen even if "<event id=" ..> exist. I also tried
<xsl:when test="element-available('event')"> 
but the result is the same as your solution.

Then I tried <xsl:when test="count(//event) &gt; 0"> but result is the same as with
<xsl:when test="event"> (if "event" don't exists in xml file, I want to write a message
"No data available").

Any idea?

Thanks
Stefan

----- Original Message ----- 
From: "Michael Duffy" <duffymo@yahoo.com>
To: "Tag Libraries Users List" <taglibs-user@jakarta.apache.org>
Sent: Friday, May 09, 2003 2:47 PM
Subject: Re: taglibs and xsl problem


> 
> Hi Stefan,
> 
> Are you looking for the element-available() function? 
> 
> 
> If I understand you correctly, I think your <xsl:when>
> should be rewritten like this:
> 
> <xsl:when test='element-available("event")'>
> 
> You can find more details in Appendix C of the
> O'Reilly XSLT book by Doug Tidwell.
> 
> I wish I could try it and prove it out before I reply,
> but when I try to run Xalan it throws a
> ClassNotFoundException when it looks for class
> org.apache.xml.dtm.ref.IncrementalSAXSource_Xerces. 
> My jars must be out of date.  I'm downloading the
> latest stuff from xml.apache.org now.  
> 
> Try it out for yourself.  When I finally get the
> latest Xerces downloaded, I'll do the same.  Thanks -
> MOD
> 
> 
> --- Stefan Trcko <stefan.trcko@aladin-eng.si> wrote:
> > Hello
> > 
> > I have problem with xsl and taglibs-xtags.tld
> > 
> > This is my jsp file in which I connect to URL and
> > then show styled data using xsl file.
> > My question is how to check that I can connect to
> > this URL (real URL will not be localhost, this is
> > just sample) and if i can't, write a message (e.g.
> > Could not connect to URL).
> > 
> > <%@ taglib uri="/WEB-INF/tlds/taglibs-xtags.tld"
> > prefix="xsltlib" %>
> > <html><head><title></title></head>
> > <body bgcolor="white">
> > <font color="red">Info</font>
> > <xsltlib:style
> > xml="http://localhost:8083/web/xml_sample.xml"
> >
> xsl="/WEB-INF/templates/jsp/layouts/xsl_sample.xsl"/>
> > </body>
> > </html>
> > 
> > 
> > This is my xsl file, and my next question is how to
> > test if "event" exists in xml file, because
> > otherwise I want to write a message (e.g. No data).
> > I try code below, but
> > when there is no "event" in the XML file, message
> > "No data" is not written.
> > 
> > 
> > <xsl:choose>
> > <xsl:when test="event">
> > State 
> > <xsl:for-each select="event">
> > <xsl:value-of select="@entry"/>
> > <xsl:value-of select="@message"
> > disable-output-escaping="yes"/>
> > </xsl:for-each>
> > </xsl:when>
> > <xsl:otherwise>
> > No data
> > </xsl:otherwise>
> > </xsl:choose> 
> > </xsl:template>
> > </xsl:stylesheet>
> > 
> > This is my XML file with one event:
> > 
> > <?xml version="1.0" encoding="windows-1250" ?>
> > <info_xml lang="SLO">
> > <event id="32350" entry="08.05.2003 14:07"
> > message="some text" />
> > </info_xml>
> > when there are no events the XML looks like:
> > 
> > <?xml version="1.0" encoding="windows-1250" ?>
> > <info_xml lang="SLO">
> > </info_xml>
> > 
> > Any ideas?
> > 
> > Thanks
> > Stefan
> 
> 
> __________________________________
> Do you Yahoo!?
> The New Yahoo! Search - Faster. Easier. Bingo.
> http://search.yahoo.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: taglibs-user-help@jakarta.apache.org
> 
> 
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message