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 taglibs and xsl problem
Date Fri, 09 May 2003 09:39:42 GMT
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
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message