[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] load the next node value


Subject: Re: [xsl] load the next node value
From: "cking" <cking@xxxxxxxxxx>
Date: Thu, 9 Sep 2004 00:56:58 +0200

<?xml version="1.0" encoding="iso-8859-1"?>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

 <xsl:output method="html" version="1.0" encoding="iso-8859-1" indent="yes" omit-xml-declaration="yes"/>

 <xsl:key name="sn-comp"
  match="/sn_servicioproyecto/sn_masterinformacion/composicioninformacion/sn_composicioninformacion"
  use="composicioninformacion_alias"/>

 <xsl:template match="/sn_servicioproyecto">
  <html>
   <head><title>servicioproyecto</title></head>
   <body>
    <xsl:apply-templates select="sn_masterinformacion/composicioninformacion"/>
   </body>
  </html>
 </xsl:template>

 <xsl:template match="composicioninformacion">
  <xsl:apply-templates select="sn_composicioninformacion[starts-with(composicioninformacion_alias, 'autor_')]"/>
 </xsl:template>

 <xsl:template match="sn_composicioninformacion">
  <span class="lognameabout">
   <xsl:value-of select="substring-after(composicioninformacion_alias, 'autor_')"/>
   <xsl:text>. Autorea: </xsl:text>
  </span>
  <span class="navnumber">
   <xsl:variable name="link" select="key('sn-comp', concat('link_', composicioninformacion_alias))"/>
   <xsl:choose>
    <xsl:when test="$link">
     <a href="{$link/metadatosinformacion_texto}">
      <xsl:value-of select="metadatosinformacion_texto"/>
     </a>
    </xsl:when>
    <xsl:otherwise>
     <xsl:value-of select="metadatosinformacion_texto"/>
    </xsl:otherwise>
   </xsl:choose>
   <xsl:variable name="org" select="key('sn-comp', concat('organizacion_', composicioninformacion_alias))"/>
   <xsl:if test="$org">
    <xsl:text>, Org </xsl:text>
    <xsl:variable name="link-org" select="key('sn-comp', concat('link_organizacion_', composicioninformacion_alias))"/>
    <xsl:choose>
     <xsl:when test="$link-org">
      <a href="{$link-org/metadatosinformacion_texto}">
       <xsl:value-of select="$org/metadatosinformacion_texto"/>
      </a>
     </xsl:when>
     <xsl:otherwise>
      <xsl:value-of select="$org/metadatosinformacion_texto"/>
     </xsl:otherwise>
    </xsl:choose>
   </xsl:if>
   <br/>
  </span>
 </xsl:template>

</xsl:stylesheet>

output:

  <span class="lognameabout">1. Autorea: </span>
  <span class="navnumber"><a href="1">qqqqqqqqqqqqqqqqq</a>, Org <a href="3">2</a><br></span>
  <span class="lognameabout">2. Autorea: </span>
  <span class="navnumber"><a href="5">4</a>, Org 6<br></span>

Cheers,
Anton Triest


Dionisio Ruiz de Zarate wrote:
>
> thanks, it runs well.
> now i want to get other node:
> i show now, using you code, this:
> <span class="lognameabout">1. Autorea: </span>
> <span class="navnumber"><a href="1">qqqqqqqqqqqqqqqqq</a><br></span>
>
> and now i want to show that and the node with the value organizacion_autor_1
> and it metadatosinformacion_texto node value
>
> <span class="lognameabout">1. Autorea: </span>
> <span class="navnumber"><a href="1">qqqqqqqqqqqqqqqqq</a><br></span>, Org <a
> href="2">3</a><br/>,
>
> an you help me please?


Current Thread