Xsl and Jsp
Hi,
I have a java class and a jsp. This jsp is showing the output in a drop down which containg all the values of a column from the database table. I need to display the same dropdown by xslt in html output. I have a cariable name called atoztopics in my JSP that is displaying all the values from an array while calling a java class.
How can i use this variable in xslt to call the same java class with same output values in the dropdown. I am getting dropdown in the html output when i am running my xslt but i am not getting any values in the dropdown as i am getting the same values in jsp.
My xslt is look like this :
<?xml version="1.0"?>
<!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "#160;"> ]>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" encoding="UTF-8" indent="yes"/>
<xsl:param name="outputContext" />
<xsl:param name="formInputValue" />
<xsl:param name="formInputName" />
<xsl:param name="considerDefault" />
<xsl:param name="visible" />
<xsl:param name="disable" />
<xsl:param name="currentUser" />
<xsl:template match="/">
<xsl:choose>
<xsl:when test="$visible='true'">
<xsl:choose>
<xsl:when test="$outputContext='head'">
<xsl:apply-templates select="child::*" mode="head"/>
</xsl:when>
<xsl:when test="$outputContext='body'">
<xsl:apply-templates select="child::*" mode="body"/>
</xsl:when>
</xsl:choose>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template match="child::*" mode="head">
</xsl:template>
<xsl:template match="child::*" mode="body">
<xsl:variable name="atoZTopics" select="$formInputName" />
<xsl:variable name="val">
<xsl:choose>
<xsl:when test="normalize-space($formInputValue)">
<xsl:value-of select="normalize-space($formInputValue)"/>
</xsl:when>
</xsl:choose>
</xsl:variable>
<select class="vign-formElementControl" name="{$atoZTopics}" id="{$atoZTopics}">
<xsl:if test="$disable='true'">
<xsl:attribute name="disabled">disabled</xsl:attribute>
</xsl:if>
<xsl:for-each select="row">
<xsl:variable name="name" select="name"/>
<xsl:variable name="value" select="value"/>
<xsl:variable name="selected" select="selected"/>
<xsl:choose>
<xsl:when test="$selected='1'">
<option value="{$value}"><xsl:attribute name="selected">selected</xsl:attribute><xsl:value-of select="$name"/></option>
</xsl:when>
<xsl:otherwise>
<option value="{$value}"><xsl:value-of select="$name"/></option>
</xsl:otherwise>
</xsl:choose>
<xsl:value-of select="$name"/><br/>
</xsl:for-each>
</select>
</xsl:template>
</xsl:stylesheet>
Could you please help me ..how to get the desired out put from this xsl. Where and how to pass the values in xsl.
Please do the needful.
Thanks
Vipin
|