You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Joseph Ferner <jo...@cox.net> on 2003/10/03 22:38:15 UTC
Problem using jpath and xsp tags together (possible bug or just misunderstanding)
The Problem:
I'm trying to create an xml document using xsp and jpath that looks like
this:
<root>
<element value="myval">
<subelement/>
</element>
<element>
<subelement/>
</element>
</root>
The object I'm pulling from will either return null or another object
which has the string in it (in this case "myval")
So I wrote code like this (xsp):
...
<root>
<jpath:for-each select="elems">
<element>
<jpath:if test="./someObject">
<xsp:attribute name="value">
<jpath:value-of select="./someObject/myString"/>
</xsp:attribute>
</jpath:if>
<subelement/>
</element>
</jpath:for-each>
</root>
...
I get this from the above code: (the value is in the wrong element)
<root>
<element>
<subelement value="myval"/>
</element>
<element>
<subelement/>
</element>
</root>
So then I tried this:
...
<root>
<jpath:for-each select="elems">
<element>
<xsp:attribute name="value">
<jpath:if test="./someObject">
<jpath:value-of select="./someObject/myString"/>
</jpath:if>
</xsp:attribute>
<subelement/>
</element>
</jpath:for-each>
</root>
...
And I get this every time: (no value)
<root>
<element value="">
<subelement/>
</element>
<element value="">
<subelement/>
</element>
</root>
I then looked at the generated java code for the second try and the
jpath code is never generated in the java file.
Joseph Ferner
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org