Subject: [xsl] How to overrite default rendering toretain name=value attribute pairs From: "Karlmarx Rajangam" <karlmarx.rajangam@xxxxxxxxxxxxxxxxxx> Date: Fri, 15 Jun 2007 08:35:19 -0400 |
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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] problem processing <stron, Joe Fawcett | Thread | Re: [xsl] How to overrite default r, David Carlisle |
Re: [xsl] JDK 1.4 <> 5.0 transforma, Kai Hackemesser | Date | Re: [xsl] JDK 1.4 <> 5.0 transforma, David Carlisle |
Month |