Apache Jelly XML template: conditionally render tag attribute

ormipase

New Member
I am using a Jelly script to generate an HTML ordered list. Sometimes I want \[code\]<li value="http://stackoverflow.com/questions/11418246/...${computed}...">...big block...</li>\[/code\] and other times I want just \[code\]<li>...</li>\[/code\] with no \[code\]value\[/code\] attribute. \[code\]value=""\[/code\] is not legal - it must be an integer.I could use \[code\]<j:choose>\[/code\] to write two blocks, one using \[code\]value\[/code\] and one not, but then my template has to duplicate all the content inside the list item, which would make it uglier and harder to maintain.In XSLT, you can use \[code\]xsl:attribute\[/code\] for this purpose. Is there any equivalent in Jelly?
 
Back
Top