I'm writing an application in C# using .NET Framework 3.5 to implement a series of transforms. I'm using the XslCompiledTransform class to perform the transforms. I'd like to avoid writing a bunch of for-each statements in my XSLT transforms so I'd like to select some data based on an attribute. My source data looks as follows.
<Radios>
<Radio name="UHF1">
<GUID protected="true">785A9539-918B-4DCE-A9AA-AC9D6275EA86</GUID>
<DigitalAudioDeviceInstance protected="true">1</DigitalAudioDeviceInstance>
<DigitalAudioDevicePort>2</DigitalAudioDevicePort>
<ACIMLocalInstance protected="true">1</ACIMLocalInstance>
<ACIMLocalPort>2</ACIMLocalPort>
<ACIMSCCInstance protected="true">1</ACIMSCCInstance>
</Radio>
<Radio name="VHF1">
<GUID protected="true">C150EA26-E53E-4366-B4A0-84BF619BFD3A</GUID>
<DigitalAudioDeviceInstance protected="true">2</DigitalAudioDeviceInstance>
<DigitalAudioDevicePort>2</DigitalAudioDevicePort>
<ACIMLocalInstance protected="true">2</ACIMLocalInstance>
<ACIMLocalPort>6</ACIMLocalPort>
<ACIMSCCInstance protected="true">2</ACIMSCCInstance>
</Radio>
</Radios>
I'm using the following to trying to reference the "ACIMSCCInstance" from a Radio:
<xsl:value-of select="Radios/Radio/ACIMSCCInstance[@name=UHF1]"/>
This is not working however Keep in mind that "Radios" is NOT the root of the document, and I am in fact at the appropriate level where this relative path should work. Just to make sure I tried this:
<xsl:value-of select="Radios/Radio/ACIMSCCInstance"/>
Which of course gives me the "ACIMSCCInstance" value ("1") of the first radio in the list.
My Question is, why doesn't the "[@name=UHF1]" at the end of the path work at picking the radio with the name "UHF1". I've also tried this "@name='UHF1']" and no dice.