Finding out the type of object returned by parse is left as an excercise for the reader, since I don't have the spec handy.
R
Christian Andersson wrote:
Hi all!
Does anyone know if it is it possible to send the "document" variable
created by a x:set as a parameter to a tag file? I need to continue with xml x xpath expressions within the tag file.
Example:
FILE: index.jsp
<%@ taglib uri="http://java.sun.com/jsp/jstl/xml" prefix="x" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="tags" tagdir="/WEB-INF/tags" %>
<c:set var="xml">
<record_list>
<record>
<field>
<string>
<red>Volvo</red>
</string>
</field>
<field>
<string>
<black>1200</black>
</string>
</field>
...
</record>
</record_list>
</c:set>
<x:parse doc="${xml}" var="document"/>
<x:forEach select="$document/record_list/record/field" var="node"> <x:if select="$node/string"> <x:set var="string" select="$node/string"/> <tags:formatString string="$string"/> </x:if> ... <x:if select...> </x:if> </x:forEach>
FILE: formatString.tag
<%@ taglib uri="http://java.sun.com/jsp/jstl/xml" prefix="x" %> <%@ attribute name="string" %>
<x:choose>
<x:when select="$string/red" var="text">
<font style="font-color:red"><x:out
select="$text"/></font>
</x:when>
<x:when select="$string/black" var="text">
<font style="font-color:black"><x:out
select="$text"/></font>
</x:when>
</x:choose>
Thanks for your help
/Christian Andersson
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--
"...all experience hath shewn, that mankind are more disposed to suffer, while evils are sufferable, than to right themselves by abolishing the forms to which they are accustomed. But when a long train of abuses and usurpations, pursuing invariably the same Object evinces a design to reduce them under absolute Despotism, it is their right, it is their duty,to throw off such Government, and to provide new Guards for their future security"
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
