Subject: [xsl] "<xsl:if expr" doesnot work..Help!! From: Gurnandan Kaur <teclioness@xxxxxxxxxxx> Date: Thu, 20 Sep 2001 08:16:03 +0100 (BST) |
Hi I have a problem...I am creating a xsl file, in which I am using xsl:script to get back a value depending on the node matching. The xsl:eval function gets me the right result, but when I use it in xsl:if expr, it says, "cannot assign to function result"..Here is the xml and xsl please help.. Thanks in advance XML: <!-- edited with XML Spy v3.5 NT (http://www.xmlspy.com) by () --> <?xml-stylesheet type="text/xsl" href="D:\Inetpub\wwwroot\AHWRework\Ethnic\new.xsl"?> <ScreenPopulate> <Nationalitys> <Nationality alpha="(A)"> <Key>{11277AE8-6967-11D5-A190-000347240DC9}</Key> <Item>British or Mixed British</Item> </Nationality> <Nationality alpha="(B)"> <Key>{11277AEA-6967-11D5-A190-000347240DC9}</Key> <Item>English</Item> </Nationality> <Nationality alpha="(C)"> <Key>{11277AEB-6967-11D5-A190-000347240DC9}</Key> <Item>Irish</Item> </Nationality> <Nationality alpha="(D)"> <Key>{11277AEC-6967-11D5-A190-000347240DC9}</Key> <Item>Scottish</Item> </Nationality> <Nationality alpha="(E)"> <Key>{11277AED-6967-11D5-A190-000347240DC9}</Key> <Item>Welsh</Item> </Nationality> <Nationality alpha="(F)"> <Key>{11277AEE-6967-11D5-A190-000347240DC9}</Key> <Item>Other (specify if you wish)</Item> </Nationality> <Nationality> <Key>{7FB1E1A2-A856-11D5-A1A9-000347240DC9}</Key> <Item>No Reply</Item> </Nationality> </Nationalitys> <Backgrounds> <Background Group="Asian" alpha="(A)"> <Key>{11277AEF-6967-11D5-A190-000347240DC9}</Key> <Item>Bangladeshi</Item> </Background> <Background Group="Asian" alpha="(B)"> <Key>{11277AF0-6967-11D5-A190-000347240DC9}</Key> <Item>Indian</Item> </Background> <Background Group="Asian" alpha="(C)"> <Key>{11277AF 1-6967-11D5-A190-000347240DC9}</Key> <Item>Pakistani</Item> </Background> <Background Group="Asian" alpha="(D)"> <Key>{11277AF2-6967-11D5-A190-000347240DC9}</Key> <Item>Other (specify if you wish)</Item> </Background> <Background Group="Black" alpha="(E)"> <Key>{11277AF3-6967-11D5-A190-000347240DC9}</Key> <Item>African</Item> </Background> <Background Group="Black" alpha="(F)"> <Key>{11277AF4-6967-11D5-A190-000347240DC9}</Key> <Item>Caribbean</Item> </Background> <Background Group="Black" alpha="(G)"> <Key>{11277AF5-6967-11D5-A190-000347240DC9}</Key> <Item>Other (specify if you wish)</Item> </Background> <Background Group="Chinese" alpha="(H)"> <Key>{11277AF6-6967-11D5-A190-000347240DC9}</Key> <Item>Chinese (specify if you wish</Item> </Background> <Background Group="Mixed Ethnic Background" alpha="(I)"> <Key>{11277AF7-6967-11D5-A190-000347240DC9}</Key> <Item>Asian and White</Item> </Background> <Background Group="Mixed Ethnic Background" alpha="(J)"> <Key>{11277AF8-6967-11D5-A190-000347240DC9}</Key> <Item>Black African and White</Item> </Background> <Background Group="Mixed Ethnic Background" alpha="(K)"> <Key>{11277AF9-6967-11D5-A1 90-000347240DC9}</Key> <Item>Black Caribbean and White</Item> </Background> <Background Group="Mixed Ethnic Background" alpha="(L)"> <Key>{11277AFA-6967-11D5-A190-000347240DC9}</Key> <Item>Other (specify if you wish)</Item> </Background> <Background Group="White" alpha="(M)"> <Key>{11277AFB-6967-11D5-A190-000347240DC9}</Key> <Item>White (specify if you wish)</Item> </Background> <Background Group="Other Ethnic Background" alpha="(N)"> <Key>{11277AFC-6967-11D5-A190-000347240DC9}</Key> <Item>Other (specify if you wish)</Item> </Background> <Background Group=""> <Key>{7FB1E1A1-A856-11D5-A1A9-000347240DC9}</Key> <Item>No Reply</Item> </Background> </Backgrounds> </ScreenPopulate> XSL: <?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/TR/WD-xsl"> <xsl:template match ="/"> <html> <head> <title>Ethnic Origin</title> </head> <body> <table class="TableFullWidth" width="100%"> <tr class="HeadRow" bgcolor="silver"> <td align="center" colspan="2"><b>Ethnic Monitoring Questionnaire</b></td> </tr> <tr height="60"> <td colspan="2">Which groups do you most identify with? Please tick only <b><u>ONE</u></b> box in <b>column A <u>and ONE</u></b> box in <b>column B</b> (The options are listed alphabetically). If you work in Northern Ireland, please answer the additional question in column A.</td> </tr> <tr> <td width="40%" valign="top"> <table width="100%" cellpading="0" cellspacing="0"> <tr> <td> <b>Column A</b> </td> </tr> <tr> <td> <xsl:for-each select="/ScreenPopulate/Nationalitys/Nationality"> <xsl:value-of select="@alpha"/><input type="radio" name="RadioNation" value="{./Key}"></input><xsl:value-of select="./Item"/> <br/> </xsl:for-each> <br/>       <input type="text" name="txtNation"/> </td> </tr> <tr height="60" valign="bottom" > <td> PLEASE ALSO ANSWER THE QUESTION BELOW <b>ONLY IF YOU WORK IN NORTHERN IRELAND:</b> </td> </tr> <tr> <td> Are you a member of the Irish Traveller Community? </td> </tr> <tr> <td> (T) <input type="radio" name="radioNorthern" value="Y">Yes</input> <br/> ( ) <input type="radio" name="radioNorthern" value="N">No</input> </td> </tr> </table> </td> <td width="60%" valign="top"> <table width="100%" cellpading="0" cellspacing="0"> <tr> <td> <b>Column B</b> </td> </tr> <xsl:for-each select="/ScreenPopulate/Backgrounds/Background"> <xsl:if expr="testVal() = 'no'"> <tr height="50"> <td> <b><xsl:value-of select="@Group"/></b><!--<xsl:eval>testVal()</xsl:eval>--> </td> </tr> </xsl:if> <tr> <td> <xsl:value-of select="@alpha"/><input type ="radio" name="radioBackground"><xsl:attribute name="value"><xsl:value-of select="./Key"/></xsl:attribute></input><xsl:value-of select="./Item"/><br/> </td> </tr> </xsl:for-each> </table> </td> </tr> </table> </body> </html> </xsl:template> <xsl:script><![CDATA[ strVal="aa" function testVal(attVal){ attVal = this.attributes.item(0).text if (strVal == attVal ){ return "yes"; } else{ strVal= attVal ; return "no"; } //return attVal ; } //]]></xsl:script> </xsl:stylesheet> ____________________________________________________________ Do You Yahoo!? Get your free @yahoo.co.uk address at http://mail.yahoo.co.uk or your free @yahoo.ie address at http://mail.yahoo.ie XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Re:FW: How to realize doc, Kumar, Yaswanth | Thread | RE: [xsl] "<xsl:if expr" doesnot wo, Chris Bayes |
[xsl] Re:FW: How to realize documen, Yang | Date | RE: [xsl] Re:FW: How to realize doc, Kumar, Yaswanth |
Month |