I have a problem. Basically I want to get an output with selected="true"
for <option/>, instead of WITHOUT "true". Even though <option selected/>
is a valid html, I need to get name=value pair (selected=true) as we try
to form & pass an XML input for some other validation.
We must create something like,
<choice>
<option selected = "true">cc</option>
<!-- NOT THIS WAY <option selected>cc</option> -->
<option>bbb</option>
</choice>
Tried 2 ways:(A)
<xsl:for-each select="OPTION">
inputXML += '<option>
<xsl:if test="@SELECTED='true'"><xsl:attribute
name="Selected">true</xsl:attribute></xsl:if><xsl:value-of select="."/>
</option>\n';
</xsl:for-each>
Results in <option selected>xxx</option>, without ="TRUE" thereby
becoming an INVALID XML
So, I tried (B),
<xsl:for-each select="OPTION">
<xsl:choose>
<xsl:when test="@SELECTED='true'">inputXML += '<option
selected="true"><xsl:value-of
select="."/></option>\n';</xsl:when>
<xsl:otherwise>inputXML += '<option><xsl:value-of
select="."/></option>\n';</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
thinking < will be rendered a <, but resulted only as
<option selected="true">xxx</option>
Any suggestion how I can fix this?
Thanks in advance,
karl
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--