Re: [xsl] load the next node value (the las question?)

Subject: Re: [xsl] load the next node value (the las question?)
From: "cking" <cking@xxxxxxxxxx>
Date: Fri, 10 Sep 2004 20:26:56 +0200
Hi Dionisio,

You sure have looong tagnames there! :)

To answer your question: first, you can include the "fotografo" records
by adding an apply-templates:

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

So now, the "sn_composicioninformacion" template will be called for
records starting with "autor_" or "fotografo_". Inside that template, it's not
too difficult to replace the hardcoded "autor_" and ". Autorea:" strings with
a little variable/choose/when construct:

    <xsl:template match="sn_composicioninformacion">
        <span class="lognameabout">
            <xsl:variable name="id" select="substring-before
                (composicioninformacion_alias, '_')"/>
            <xsl:value-of select="substring-after
                (composicioninformacion_alias, '_')"/>
            <xsl:choose>
                <xsl:when test="$id = 'autor'">. Autorea: </xsl:when>
                <xsl:when test="$id = 'fotografo'">. Fotografo: </xsl:when>
            </xsl:choose>
        </span>
        <span class="navnumber">
            ... (the rest stays the same)

Cheers,
Anton Triest


Dionisio Ruiz de Zarate wrote:
>

> this is the last.
> thanks for your code it runs well
> Now i want to add one node more.
> i have the bellow XML file (the same file but with more nodes) an i want to
> load this:
>
> with you send me code i load this:
>   <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>
>
> but i want to add this to the previous out put:
>
>   <span class="lognameabout">1. fotografo: </span>
>   <span class="navnumber"><a href="link a el fotografo1">el fotografo1</a>,
> Org <a href="link org fot 1">org fot 1</a><br></span>
>   <span class="lognameabout">2. fotografo: </span>
>   <span class="navnumber"><a href="link a el fotografo2">el fotografo2</a>,
> <a href="link org fot 2">org fot 2</a><br></span>
>
> then there is some nodes with the name with the name
> composicioninformacion_alias, in the previous email i tested this node but
> with the value autor_1.. organizacion_autor_....
> and now i want to test the same nodes but with the value fotografo_1,
> organizacion_fotografo_1 and link_organizacion_fotografo_1
>
> tha xml file is the bellow file.
>
> Can you help me (i hope the last question is this).
>
> i hope your answer.
>
> Thank you very very much.
>
> XML FILE:
>
> <?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?>
> <sn_servicioproyecto>
> <sn_masterinformacion>
> <composicioninformacion>
> <sn_composicioninformacion>
> <composicioninformacion_alias><![CDATA[titulo]]></composicioninformacion_ali
> as>
> <metadatosinformacion_texto><![CDATA[qqqqqqqqqq]]></metadatosinformacion_tex
> to>
> </sn_composicioninformacion>
> <sn_composicioninformacion>
> <composicioninformacion_alias><![CDATA[autor_1]]></composicioninformacion_al
> ias>
> <metadatosinformacion_texto><![CDATA[qqqqqqqqqqqqqqqqq]]></metadatosinformac
> ion_texto>
> </sn_composicioninformacion>
> <sn_composicioninformacion>
[snip]

Current Thread