You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by gu...@teleco.upv.es on 2000/03/08 19:34:35 UTC

Template problem

Hi friends

I have a document which looks more or less like this:

<question id="in1">
<text>Hallo?</text>
</question>

I have create using DOM an element called "in1".What i want to do is as
follows:

<xsl:template match="text">
       <xsl:variable name="reply">
           <xsl:value-of select="../@id"/>   
        </xsl:variable>
        <xsl:variable name="reply1">
             <xsl:value-of select="../$reply"/>   
         </xsl:variable>
</xsl:template>

That is, i want to acces to the value of the element "in1" but not
directly. First getting the name of the element from the attribute "id"
of the element "question" and after use the value of "id" in a patten
for acces to the value of the "in1" element.

I have tried with the code above and whith this:

<xsl:template match="text">
       <xsl:variable name="reply">
           <xsl:value-of select="../{@id}"/>   
        </xsl:variable>
       
</xsl:template>

but both possibilities are wrong. I am using Cocoon 1.6.1.

How can i figure out the problem?

Any help is apreciated. Thanks.

xsp development environment

Posted by "K. Rumman Akhter" <ka...@sputnik7.com>.
i know this is wishful thinking, but does anyone know of a good xsp
development environment or extension for emacs/textpad/bbedit/??? i long for
syntax highlighting and automatic indentation and bracket matching
(GNU/Xemacs...sigh...). i don't know much about writing one, but if anyone
else is interested, we could work on one...

ah well, one can dream...
RUm


Re: Template problem

Posted by Phil Lanch <ph...@aldigital.co.uk>.
guiferpo@teleco.upv.es wrote:
> 
> Hi friends
> 
> I have a document which looks more or less like this:
> 
> <question id="in1">
> <text>Hallo?</text>
> </question>
> 
> I have create using DOM an element called "in1".What i want to do is as
> follows:
> 
> <xsl:template match="text">
>        <xsl:variable name="reply">
>            <xsl:value-of select="../@id"/>
>         </xsl:variable>
>         <xsl:variable name="reply1">
>              <xsl:value-of select="../$reply"/>

i think it works if you change the previous line to-

<xsl:value-of select="../*[name() = $reply]"/>

-or to-

<xsl:value-of select="../*[name() = ../@id]"/>

-(which makes the first variable unnecessary).

>          </xsl:variable>
> </xsl:template>
> 
> That is, i want to acces to the value of the element "in1" but not
> directly. First getting the name of the element from the attribute "id"
> of the element "question" and after use the value of "id" in a patten
> for acces to the value of the "in1" element.

-- 

cheers

phil

"How did you enjoy yourself with these people?
Answer: very much, almost as much as I do when alone."