[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: element value based on attribute selection
Hi Dave, > I want to select the value of the <parameter > name="UserDN">wjohnson</parameter> out of all the > <parameter> tags. > > <xsl:apply-templates select="//parameter???"/> What is it about that parameter that you want to select on - presumably its name attribute? You can get the value of the name attribute with: @name Test whether it's the same as 'UserDN' with: @name = 'UserDN' and if you put that in a predicate (square brackets) it'll filter the list of parameter elements accordingly: //parameter[@name = 'UserDN'] You might find it better to step down to the parameter elements rather than use // - otherwise the processor will hunt for parameter elements all through the document when it doesn't really need to. Use: /parameters/parameter[@name = 'UserDN'] If you have *lots* of parameter elements, and you're picking them out by their name lots of times, you might find it helpful to define a key so you can index into them: <xsl:key name="parameters" match="parameter" use="@name" /> Then you can use: key('parameters', 'UserDN') instead. [If you wanted to get it by position, use: /parameters/parameter[1] as it's the first parameter in the list.] I hope that helps, Jeni --- Jeni Tennison http://www.jenitennison.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|