tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Duffy <duff...@yahoo.com>
Subject Re: taglibs and xsl problem
Date Fri, 09 May 2003 12:47:37 GMT

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
View raw message