Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - Need to select element by attribute value [Thread Next] Re: Need to select element by attribute valueTo: NULL Date: 9/4/2004 11:26:00 AM matt redmond wrote: > Hi All, > > Given the snippet of XML below: > > <TransactionResponse> > <OptionalInfo FieldCount="9"> > <OptionalField Name="BillCycle">01</OptionalField> > <OptionalField Name="CCAddedDate">6/15/2004 7:58:40 > AM</OptionalField> > <OptionalField Name="MDN">7868973602</OptionalField> > <OptionalField Name="CCNumber">5***********6552</OptionalField> > <OptionalField Name="CCExpMM">06</OptionalField> > <OptionalField Name="CCExpYY">05</OptionalField> > <OptionalField Name="Zip5">33178</OptionalField> > <OptionalField Name="DeclineCode"></OptionalField> > <OptionalField Name="SheetName">MPCS_MMDDYYYY</OptionalField> > </OptionalInfo> > </TransactionResponse> > > How can I access the 'OptionalField' elements by selecting them based > on the value of their 'Name' attribute? Right now I am using: > > <xsl:value-of select="OptionalInfo/OptionalField[x]"/> > > Where 'x' is the index of the element I want. In the system I'm > working with the order of those 'OptionalField' elements isn't > guaranteed - so I need to access them based on their 'Name'. > > FWIW, the structure of the above is fixed - I do not have the option > of changing the schema. > > TIA, > > matt redmond <xsl:value-of select="OptionalInfo/OptionalField[@Name='Name']"/> | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
