Re: [xsl] add an attribute to an element, then use it in another template

Subject: Re: [xsl] add an attribute to an element, then use it in another template
From: Florent Georges <lists@xxxxxxxxxxxx>
Date: Wed, 5 Mar 2008 14:31:57 +0100 (CET)
Pablo Sebastian Rodriguez wrote:

> with

> <music>
>     <project name="W.A.S.T.E.">
>         <release name="We all seek total entropy" year="2003"/>
>         <release name="Violent delights" year="2006"/>
>     </project>
> </music>

> i get

> attrName: name
> attrValue: W.A.S.T.E.

> if i had

> <music>
>     <project name="W.A.S.T.E." newThing="qwertyu">
>         <release name="We all seek total entropy" year="2003"/>
>         <release name="Violent delights" year="2006"/>
>     </project>
> </music>

> the result would be

> attrName: name
> attrValue: W.A.S.T.E

> attrName: newThing
> attrValue: qwertyu

    <xsl:template match="project/@*">
       <xsl:text>attrName: </xsl:text>
       <xsl:value-of select="name()"/>
       <xsl:text>&_#10;attrValue: </xsl:text>
       <xsl:value-of select="."/>
       <xsl:text>&_#10;&_#10;</xsl:text>
    </xsl:template>

    <xsl:apply-templates select=".../project/@*"/>

  Regards,

--drkm
























      _____________________________________________________________________________ 
Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail http://mail.yahoo.fr

Current Thread