[quote=schistossoma]Tu podes juntar os dois XSL em um só, passando um parâmetro para diferenciar qual versão ele deve usar. Algo como:
if parametro = tal then versao full else versao light
Em uma empresa onde trabalhei utilizávamos dessa maneira para diferenciar. Geralmente eram relatórios onde o usuário escolhia quais informações deveriam ser mostradas. É um pouco trabalhoso e de difícil manutenção, mas funciona. :)[/quote]
rpz poe trabalhoso nisso e dificul manutencao nem se fala. no meu caso eu terei que carregar uma delas, tipo vou carregar a tabela resumida, ai tera um menu logo acima com os link para as outras opcoes tipo relatorio full, porem esse link nao pode levar para um arquivo que tenha codigo duplicado, e sim o arquivo principal que nele eu tenho o full e o resumo. aqui o codigo.
<xsl:choose>
<xsl:when test="'common'=cvstags/@proper"> <!-- comparamos se o valor está igual a '' (vazio) -->
<table border="1" cellpadding="0" cellspacing="0">
<xsl:for-each select="/cvstags/project">
<xsl:sort select="@id" order="ascending"/>
<xsl:variable name="project" select="@id"/>
<tr style="font-size: 200%">
<td style="background-color: orange" colspan="6">
<a id="{$project}"/>
 <xsl:value-of select="$project"/> - <a href="{concat($audits,$project)}">audits</a> - <a href="http://w3afs.btv.ibm.com/~bwf/projmgmt/cvstags/merge_head.xml">merges</a>
</td>
</tr>
<xsl:if test="branch|tag">
<tr style="background-color: yellow">
<th>Date</th>
<th>From</th>
<th>Branch/Tag</th>
<th>Description</th>
<th>Status</th>
<th>CAT</th>
</tr>
</xsl:if>
<xsl:if test="not(branch|tag)"> <!-- Se nao tem tag ou branch -->
<tr>
<td colspan="6" style="background-color: yellow">
<span style="font-size: 100%">
WARNING: No Tags or Branches have been configured for <strong><xsl:value-of select="@id"/></strong>!
</span>
</td>
</tr>
</xsl:if>
<xsl:for-each select="branch|tag"> <!-- para cada linha, se for tag ou branch, fazer um filtro aqui usando um hide -->
<xsl:sort select="@date" order="descending"/>
<xsl:if test="'Test'=@flag or 'Prod'=@flag or 'Dev'=@flag or 'oldTest'=@flag"> <!-- teste pra imprimir so os testes -->
<tr class="hover">
<xsl:if test="'Prod'=@flag">
<xsl:attribute name="style">
background-color: pink;
</xsl:attribute>
</xsl:if>
<xsl:if test="'Dev'=@flag">
<xsl:attribute name="style">
background-color: lightgreen;
</xsl:attribute>
</xsl:if>
<xsl:if test="'Test'=@flag">
<xsl:attribute name="style">
background-color: lightblue;
</xsl:attribute>
</xsl:if>
<td nowrap="nowrap">
 
<span title="Get a patch: $ cvs rdiff -u -D "{@date}" -r "{@name}" newbuild">
<xsl:value-of select="@date"/>
</span>
 
</td>
<td>
 
<a title="Get a patch: $ cvs rdiff -u -r "{@from}" -r "{@name}" newbuild" target="_new" id="{@from}" href="{concat($cvsweb,$project,'/?only_with_tag=',@from)}">
<xsl:value-of select="@from"/>
</a>
 
</td>
<td colspan="1">
 
<a title="Get a patch: $ cvs rdiff -u -r "{@from}" -r "{@name}" newbuild" target="_new" id="{@name}" href="{concat($cvsweb,$project,'/?only_with_tag=',@name)}">
<xsl:value-of select="@name"/>
</a>
 
</td>
<td>
 
<span title="Get a patch: $ cvs rdiff -u -D "{@description}" -r "{@name}" newbuild">
<xsl:value-of select="@description"/>
</span>
 
</td>
<xsl:variable name="mystatus">
<xsl:choose>
<!-- if this tag/branch has status, use it -->
<xsl:when test="@status">
<xsl:value-of select="@status"/>
</xsl:when>
<!-- otherwise, use the 'from' tag/branch status -->
<xsl:otherwise>
<xsl:variable name="myfrom" select="@from"/>
<xsl:value-of select="parent::project/*[@name=$myfrom]/@status"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<td class="{$mystatus}">
<xsl:value-of select="$mystatus"/>
</td>
<td>
 
<span title="Yes represent that the TAG was installed on CAT some time, not necessary mean that it is installed NOW, maybe there is a more recent CAT instaled">
<xsl:value-of select="@cat"/>
</span>
 
</td>
</tr>
</xsl:if> <!-- fim do meu teste -->
</xsl:for-each><!-- fim - para cada linha, se for tag ou branch, fazer um filtro aqui usando um hide -->
</xsl:for-each>
</table>
</xsl:when>
</xsl:choose>
quando o proper
de .xml recebe common ele carrega a estrutura acima que eh o relatorio resumido, quando eh vazio ele recebe a estrutura completa que eh o codigo abaixo:
<table border="1" cellpadding="0" cellspacing="0">
<xsl:for-each select="/cvstags/project">
<xsl:sort select="@id" order="ascending"/>
<xsl:variable name="project" select="@id"/>
<tr style="font-size: 200%">
<td style="background-color: orange" colspan="6">
<a id="{$project}"/>
 <xsl:value-of select="$project"/>
</td>
</tr>
<xsl:if test="branch|tag">
<tr style="background-color: yellow">
<th>Date</th>
<th>From</th>
<th>Branch</th>
<th>Tag</th>
<th>Description</th>
<th>CAT</th>
</tr>
</xsl:if>
<xsl:if test="not(branch|tag)"> <!-- Se nao tem tag ou branch -->
<tr>
<td colspan="5" style="background-color: yellow">
<span style="font-size: 100%">
WARNING: No Tags or Branches have been configured for <strong><xsl:value-of select="@id"/></strong>!
</span>
</td>
</tr>
</xsl:if>
<xsl:for-each select="branch|tag"> <!-- para cada linha, se for tag ou branch, fazer um filtro aqui usando um hide -->
<xsl:sort select="@date" order="descending"/>
<tr class="hover">
<xsl:if test="'Prod'=@flag">
<xsl:attribute name="style">
background-color: pink;
</xsl:attribute>
</xsl:if>
<xsl:if test="'Dev'=@flag">
<xsl:attribute name="style">
background-color: lightgreen;
</xsl:attribute>
</xsl:if>
<xsl:if test="'Test'=@flag">
<xsl:attribute name="style">
background-color: lightblue;
</xsl:attribute>
</xsl:if>
<td nowrap="nowrap">
 
<span title="Get a patch: $ cvs rdiff -u -D "{@date}" -r "{@name}" newbuild">
<xsl:value-of select="@date"/>
</span>
 
</td>
<td>
 
<a title="Get a patch: $ cvs rdiff -u -r "{@from}" -r "{@name}" newbuild" target="_new" id="{@from}" href="{concat($cvsweb,$project,'/?only_with_tag=',@from)}">
<xsl:value-of select="@from"/>
</a>
 
</td>
<td colspan="1">
<xsl:choose>
<xsl:when test="name(.) = 'branch'">
 
<a title="Get a patch: $ cvs rdiff -u -r "{@from}" -r "{@name}" newbuild" target="_new" id="{@name}" href="{concat($cvsweb,$project,'/?only_with_tag=',@name)}">
<xsl:value-of select="@name"/>
</a>
 
</xsl:when>
<xsl:otherwise>
 
</xsl:otherwise>
</xsl:choose>
</td>
<td>
<xsl:choose>
<xsl:when test="name(.) = 'tag'">
 
<a title="Get a patch: $ cvs rdiff -u -r "{@from}" -r "{@name}" newbuild" target="_new" id="{@name}" href="{concat($cvsweb,$project,'/?only_with_tag=',@name)}">
<xsl:value-of select="@name"/>
</a>
 
</xsl:when>
<xsl:otherwise>
 
</xsl:otherwise>
</xsl:choose>
</td>
<td>
 
<span title="Get a patch: $ cvs rdiff -u -D "{@description}" -r "{@name}" newbuild">
<xsl:value-of select="@description"/>
</span>
 
</td>
<td>
 
<span title="Get a patch: $ cvs rdiff -u -D "{@cat}" -r "{@name}" newbuild">
<xsl:value-of select="@cat"/>
</span>
 
</td>
</tr>
</xsl:for-each><!-- fim - para cada linha, se for tag ou branch, fazer um filtro aqui usando um hide -->
</xsl:for-each>
</table>
</xsl:template>
aqui a estrutura do .xml que define quem carregar:
<cvstags update_time="03-17-2009" updated_by="Camilo Neto" proper="common">
essa ai que diz quem vai carregar. Bem unificar eu ate conseguir peguei o arquivo tags.xml e to importando os xsl:
<?xml-stylesheet href="xsl/cvstags.xsl" type="text/xsl"?>
<?xml-stylesheet href="xsl/cvstags-fulltest.xsl" type="text/xsl"?>
pq neles estao a estrutura entao agora so preciso atualizar tags e mais nada, agora oque preciso eh saber exibir isso, quando o cliente clicar em completo relatorio, resumido.
alguma ideia?