cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Piroumian, Konstantin" <KPiroum...@flagship.ru>
Subject Re: Number of last child
Date Thu, 01 Mar 2001 10:39:43 GMT
Try something like this:

"//list/elem[position() = last()]/position()"
You don't need to put position() into [ and ] if you want to get its value.

Regards,
    Konstantin Piroumian.

----- Original Message -----
From: "Erwin Burgstaller" <ber@knapp.co.at>
To: <cocoon-users@xml.apache.org>
Sent: Thursday, March 01, 2001 1:33 PM
Subject: Number of last child


>
> A XSLT question:
>
> How can I refer to the number of the last child node of a certain
> parent?
>
> Say I have the following:
>
> <list>
> <elem/>
> <elem/>
> <elem/>
> </list>
>
> I want to do the following in an xsl-template:
>
> <xsl:template match="picture">
>   <td>
>     <xsl:attribute name="colspan">
>       <xsl:value-of select="//list/elem[ Position of the last element ]"/>
>     </xsl:attribute>
>     <img>
>       <xsl:attribute name="src">
>         /ec/imp/stamm/img/<xsl:value-of  select="."/>
>       </xsl:attribute>
>     </img>
>   </td>
> </xsl:template>
>
>
> when I trey "//list/elem[last()]" I get the content of the last node.
>
> Things like "//list/elem[last()]/[position()]" do not work
>
>
> BTW: Is there a possibility to write <xsl:attribute> with white spaces
> inside, without getting them into the html-code?
>
>
> Erwin
>
>
>
> ---------------------------------------------------------------------
> Please check that your question has not already been answered in the
> FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
>
> To unsubscribe, e-mail: <cocoon-users-unsubscribe@xml.apache.org>
> For additional commands, e-mail: <cocoon-users-help@xml.apache.org>
>

Mime
View raw message