May 18, 200322 yr i am trying to do this : <xsl:if test="position() mod 2!=0"> <xsl:value-of select="<"/> <xsl:value-of select="tr" /> <xsl:value-of select=">"/> </xsl:if> or <xsl:if test="position() mod 2!=0"> <xsl:value-of select="<"/> <xsl:value-of select="tr" /> <xsl:value-of select=">"/> </xsl:if> but no one of this work's! when i try to run it i get i have an error "expression expected" : "--><<-- what can i do to over ride this problem? thanks in advance PEleg
May 18, 200322 yr just take the instruction literally - is there any XML node named ">" which the script should select? Or do you just want to include some [xsl:]text here... <xsl:text>></xsl:text> Or may be you want an XML/HTML element named "tr": <xsl:element name="tr">sample text</xsl:element>.... since you are dealing with a template, why not include <tr><xsl:value-of select="table/header/col1" /></tr>...
May 18, 200322 yr Author i need to use it as opening tag <TR> and clsing </TR> so what to use? thanks peleg
May 18, 200322 yr Since you are exporting HTML <tr><xsl:value-of select="table/header/col1" /></tr>...
May 19, 200322 yr Author ok maybe i didn't explain my self correct : i want to do and if sentence that once will print <tr> and once <td> and of course will close this tags! the problem is when i try to do : <xsl:if test="position() mod 2 =0"> <TR> </xsl:if> it tells me tag <xsl:if> dont match start tag <tr> beacuse of that everyhing i tried didnt work! what to do? thnaks in advance peleg
May 19, 200322 yr <xsl:if test="position() mod 2 =0"> <TR><TD>tablerow even</TD></TR> </xsl:if> <xsl:if test="position() mod 2 =1"> <TR><TD>tablerow odd</TR></TR> </xsl:if> xml/html must be well-formed, eg, you will have to close the <TR>tag before closing the <xsl:if> tag ....
May 19, 200322 yr Author yes but the problem is this : in the start of the code : <xsl:if test="position() mod 2 =0"> <TR> </xsl:if> ..... code..... <xsl:if test="position() mod 2 =0"> </TR> </xsl:if> but this isnt working! what u gave me dont help me! what lse can i do"?
May 19, 200322 yr you will have to use correct nesting of tags. no way around it. use <xsl:if test="position() mod 2 =0"> <TR>thecomplete tablerow</TR> </xsl:if> and then <xsl:if test="position() mod 2 =1"> <TR>thecompletetablerow again</TR> </xsl:if> it's not that difficult to repeat the text between <TR> and </TR> since most computers have copy & paste nowadays ....
May 19, 200322 yr Author i knew that but i didnt want double code( same code ) on my page! beacuse of that i have posted that question hee from the begining! may god bless us all and speically the ones who fight th Terorist ( like arafat!))
May 19, 200322 yr Well, then try either ignoring the basic rules of processing XML and make up your own(the WW3C is an international body, after all ..) or learn to analyse your problem a bit further. <TR>
May 19, 200322 yr ... and while you are editing your prefs, can you take back the thread's rating? This thread doesn't deserve a 5 star rating - we have both not been very intelligent here ...
May 20, 200322 yr welcome back. It might help troubleshootig XSLT if provided with a bit more lines than just the one not working ... i take it does work now, does it?
Create an account or sign in to comment