Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - value-of select=...[@attribute] [Thread Next] Re: value-of select=...[@attribute]To: NULL Date: 7/8/2006 5:29:00 PM On Sat, 08 Jul 2006 18:52:58 +0200, Tobias Krause <spamtk@w...> wrote: >Hi, > >I got a XML file like [3] and I'd need to get the value of the type >attribute. >Why does [1] return the number it self while [2] returns the value of >the type attribute? It's doing exactly what you told it : <xsl:value-of select="phonenumbers/number[@type]"/> selects the text content of the number node, as long as it has an attribute of "type". <xsl:value-of select="@type"/> selects the value of the attribute called `type` in your XML. >Is there a way to get the value of the type attribute in the >match="entry" example? Yes, you want to use <xsl:value-of select="phonenumbers/number/@type"/> Followed swiftly by a basic XPath tutorial refresher - can I suggest http://www.w3schools.com/xpath/xpath_syntax.asp HTH Cheers - Neil >Regards, Toby > >[1] ><xsl:template match="entry"> > <xsl:value-of select="phonenumbers/number[@type]"/> ></xsl:template> > > >[2] ><xsl:template match="number"> > <xsl:value-of select="@type"/> ></xsl:template> > > >[3] ><entry private="false"> > <phonenumbers standard="mobile"> > <number type="mobile">+49176***/number> > </phonenumbers> ></entry> ------------------------------------------------ Digital Media MVP : 2004-2006 http://mvp.support.microsoft.com/mvpfaqs | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
