Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

mbb

condição IF

Recommended Posts

Estou com essa condição de IF que quero que apresente materias qunado tiver:

<xsl:if language="javascript" test="materiais" >
no firefox ela funciona no IE não pq ? o que quero fazer é mais ou menos isso :

 

if(materiais){

.....

}

 

materias e uma tag do meu XML ....

Compartilhar este post


Link para o post
Compartilhar em outros sites

È "materiais" mesmo eu que coloquei a tag com nomeerrado rsrsrs...

 

minha hierarquia do XML esta assim ....

- <root>- <exames>  <id></id>   <cod></cod>   <cod_dig></cod_dig>   <nome></nome>   <id_grupo></id_grupo>   <grupo></grupo>   <id_sub_grupo></id_sub_grupo>   <sub_grupo></sub_grupo>   <valor></valor> - <materiais>- <registro>  <id_material>1</id_material>   <material></material>   </registro>- <registro>  <id_material>2</id_material>   <material></material>   </registro>- <registro>  <id_material></id_material>   <material></material>   </registro>  </materiais>  </exames>  <paginas />   </root>

Compartilhar este post


Link para o post
Compartilhar em outros sites

Olha, me parece que acima de "materiais" tem o nível "root", tente então:

<xsl:if language="javascript" test="root/materiais">
E aliás, poste o código como está escrito no arquivo, não como é visualizado no navegador.

 

[]s

Compartilhar este post


Link para o post
Compartilhar em outros sites

Cara esse o codigo xsl.... da maneira que você colocou ai não funciona nem no FF e nem no IE....

<?xml version="1.0" encoding="ISO-8859-1"?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">	<xsl:variable name="teste" select="1" />   <xsl:template match="/">	<html>	  <head>	  </head>	  <body>		<h2>Listagem </h2>		<table border="0" cellpadding="7" width="100%" cellspacing="0" class="listResult">		  <tr class="head">			<th align="left">#.</th>			<th align="left">Cód.</th>			<th align="left">Nome</th>			<th align="left">Grupo</th>			<th align="left">Sub Grupo</th>			<th align="left">Material</th>		  </tr>		 				  <xsl:for-each select="root/exames">						 			  <tr>				<xsl:choose>				 <xsl:when test="position() mod 2 = 0">					<xsl:attribute name="class">linhaPar</xsl:attribute>				 </xsl:when>				 <xsl:otherwise>					<xsl:attribute name="class">linhaImpar</xsl:attribute>				 </xsl:otherwise>				</xsl:choose>				 <td>					<INPUT>				   		<xsl:attribute name="TYPE">checkbox</xsl:attribute>				   		<xsl:attribute name="VALUE"><xsl:value-of select="cod" /></xsl:attribute>					   	<xsl:attribute name="onClick">pedido(<xsl:value-of select="id" />,<xsl:value-of select="cod" />,'<xsl:value-of select="nome" />');</xsl:attribute>				 	</INPUT>				</td>				<td><xsl:value-of select="cod" /> - <xsl:value-of select="cod_dig" /></td>				<td><xsl:value-of select="nome" /></td>				<td><xsl:value-of select="grupo" /></td>				<td><xsl:value-of select="sub_grupo" /></td>				<td>										[b]<xsl:if language="javascript" test="materiais" >[/b]					<xsl:element name="select">					<xsl:attribute name="id">LISTA_<xsl:value-of select="id" /></xsl:attribute>					<xsl:attribute name="name">LISTA_<xsl:value-of select="id" /></xsl:attribute>					<xsl:for-each select="materiais/registro">					<xsl:element name="option">					<xsl:attribute name="value">					<xsl:value-of select="id_material"/>					</xsl:attribute>					<xsl:value-of select="material"/>					</xsl:element>					</xsl:for-each>					</xsl:element>										</xsl:if>																	</td>			   </tr>		  </xsl:for-each>		  <xsl:for-each select="root/paginas">		  <tr>			 	<td colspan="4">						 <xsl:for-each select="//text">		 					<a><xsl:attribute name="href">java script:pag(<xsl:value-of select="."/>)</xsl:attribute>			 			 - <xsl:value-of select="."/> 						  </a>   				  </xsl:for-each> 			 	</td>			 </tr>			 </xsl:for-each>	 	   		</table>	  </body>	</html>  </xsl:template></xsl:stylesheet>

Compartilhar este post


Link para o post
Compartilhar em outros sites

opa resolvi galera... funciona tanto no IE como no FF:

<xsl:variable name="mat"><xsl:value-of select="material_ok"/></xsl:variable><xsl:if test=" $mat = '1'" >

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.