[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] How an "attribute" used a step under (xsl:if) is getti
Hello, I had a requirement of assigning <input type="radio"> with checked and disabled options on certain condition. Since, I know I cannot use something like this, <input type="checkbox" name="something" value="xx"> <xsl:attribute name="checked"> <xsl:if test="@SELECTED = 'true'">checked</xsl:if> <!-- actually it was xsl:choose --> </xsl:attribute> <xsl:attribute name="disabled"> <xsl:if test="$disableFields = 'true'"> disabled </xsl:if </xsl:attribute> </input> since, the moment checked or disabled attribute is assigned, the input radio filed is going to take irrespective of whatever value it was assigned. But what surprised me was the below code, where the xsl:attribute is moved inside <xsl:if> one step below, do working fine. <input type="checkbox" name="something" value="xx"> <xsl:if test="@SELECTED = 'true'"><xsl:attribute name="checked">checked</xsl:attribute></xsl:if> <xsl:if test="$disableFields = 'true'"><xsl:attribute name="disabled">disabled</xsl:attribute></xsl:if> </input> I was sure the attribute will become part of <if> statement and won't work, but my stupid(?) instinct forced to give a try and found it perfectly assigning checked / disabled attribute to the radio field if the condition met. It this the way it is supposed to work? Thanks, Karl R
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|