[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
Re: [xsl] Getting and using an xml attribute
Subject: Re: [xsl] Getting and using an xml attribute From: "Andrew Welch" <andrew.j.welch@xxxxxxxxx> Date: Fri, 30 Nov 2007 15:48:09 +0000 |
On 30/11/2007, Aaron Johnson <artpunx@xxxxxxxxx> wrote: > Is it possible to select an attribute, take its value and re-use it elsewhere? Only if you store it in a variable that's in scope where you want to use it elsewhere, but... > I need to create a "manual" url, but because the ID value changes, I > need a way to "find out" what the ID value is first. I thought by > finding the element that contains name='Email, like this... > > //inactiveTab[@name='Email'] > > ...I could then take the value of any ID attribute and then append it > to the end of my manual URL(...as a variable?). I would then always > (hopefully!) know that the manual url would look like the > automatically generated URL. > > So, my question is, how do I capture the value of the ID attribute of > any element containing name="Home" and make it into something > "re-usable"? it sounds like you just need a key: <xsl:key name="inactiveTabByName" match="inactiveTab" use="@name"/> then to get the @ID for a given name (say 'Email') you would use: select="key('inactiveTabByName', 'Email')/@ID" cheers -- Andrew Welch http://andrewjwelch.com Kernow: http://kernowforsaxon.sf.net/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Getting and using an xml attr, Aaron Johnson | Thread | RE: [xsl] Getting and using an xml , Michael Kay |
[xsl] Getting and using an xml attr, Aaron Johnson | Date | RE: [xsl] Getting and using an xml , Michael Kay |
Month |