I want to select just one, I use the <xsl:for-each> just to change the node..
Would be ideal to have id as an attribute but the xml is returned from a taglib using TaglibHelper. I'm not sure how, or even if attributes can be used in return values with TaglibHelper. Thanks for your suggestion, I will give it a go. On 21/02/2003 11:00 am, "Robin Berjon" <[EMAIL PROTECTED]> wrote: > Mark Cance wrote: >> I then want to pick out a specific ��selection�� element using <id> as a >> reference, my preferred method is; >> <xsl:for-each select="/selections/regions/*[id=.]"> >> 1-<xsl:value-of select="description"/> >> </xsl:for-each> >> Unfortunately I cant get this to work, is my syntax wrong? > > I'm not sure I understand, do you want to select just *one* element (having > the > id you're looking for) or several? Your text describes the former, but you > consistently use xsl:for-each which points to the latter. > > Would the following to the right thing (given the id you're looking for in > $ID): > > <xsl:value-of select='/selections/regions/selection[id=$ID]/description'/> > > I don't know if you have ways to convince the external source of anything, but > given the sample data you provide it looks like they're abusing elements. > Something like > > <selection id='id1'> > <description>fr</description> > </selection> > > would imho make more sense, especially as you could associate a schema and > then > select directly using XPath's id(). --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
