Subject: [xsl] How an "attribute" used a step under (xsl:if) is getting assigned to its previous node? Is it the way it is expected to work? From: "Karlmarx Rajangam" <karlmarx.rajangam@xxxxxxxxxxxxxxxxxx> Date: Fri, 8 Jun 2007 06:33:10 -0400 |
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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] An XSLT for ODT to XSL-FO tra, Ramon Sole | Thread | Re: [xsl] How an "attribute" used a, David Carlisle |
RE: [xsl] Getting first child node , Julien Flotté | Date | Re: [xsl] How an "attribute" used a, David Carlisle |
Month |