Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - using For each witin xslt >Thread Next - Re: using For each witin xslt Re: using For each witin xsltTo: NULL Date: 3/1/2007 9:46:00 AM "Big D" <BigDaddy@n...> wrote in message news:uZc4xY6WHHA.996@T...... > I have an xml file and the data in the xml file is WMI information. I am > using a stylesheet(xslt file) to get the data I actually need from the file > that has all kinds of information. Where I have run into a problem is when > WMI properties is having multipe instances. For example, the > Win32_NetworkAdapter can have up to eight instances or more. I do not want > to extract all 8 instances of the adapters but rather the only adater I care > about is the one with the MAC address and IP Aaddress.(Active Adapter) This > information can be in any instance of the eight(1-8) and I am not able to > key off of a instance. > > How can I within my stylesheet do the logic to look grab the information > needed where the IPAddress and MAC are not null. All other adapters are > Null. > > Pseudo code of what i want to acomplish > > -------------------------------------------------------------------------- ---- > select each Win32_NetworkAdapter instance and where > "IPEnabled:Win32_NetworkAdapterConfiguration" Value="true" IS TRUE. > > IF true Then get the following values within that instance.... > > IPAddress:Win32_NetworkAdapterConfiguration" Value="10.112.14.5" > "MACAddress:Win32_NetworkAdapterConfiguration" Value="00:90:FB:0B:83:ED" > -------------------------------------------------------------------------- ---- Hmm your psuedo code does match your text description above. Are you saying the criteria for selection is that the class needs to have:- 1) IPAddress and MACAddress OR 2) IPAddress or MACAddress OR 3) only one will be IPEnabled anyway so fetch that one and get the values of IPAddress and MACAddress I'll take 3 let me know otherwise. > > <xsl:for-each > select="Property[@PName='IPAddress:Win32_NetworkAdapterConfiguration']"> > </xsl:for-each> <xsl:for-each select="Class[Property[@PName=IPEnabled:Win32_NetworkAdapterConfiguration' and Value='true']]"> </xsl:for-each> Given the context is the root node holding the Class elements the above returns all Class elements that have a property with a PName attribute = IPEnabled and a Value attribute = true. > > > > Example, XML file > <Class CName="Win32_NetworkAdapter" CInstance="0"> > <Property PName="AdapterType" Value="Ethernet 802.3" PInstance="0" Index="0" > DType="8"/> > <Property PName="Description" Value="Intel(R) PRO/100 VM Network Connection" > PInstance="0" Index="0" DType="8"/> > <Property PName="Index" Value="0" PInstance="0" Index="0" DType="19"/> > <Property PName="Installed" Value="true" PInstance="0" Index="0" > DType="11"/> > <Property PName="MACAddress" Value="00:90:FB:0B:83:ED" PInstance="0" > Index="0" DType="8"/> > <Property PName="Manufacturer" Value="Intel" PInstance="0" Index="0" > DType="8"/> > <Property PName="ServiceName" Value="E100B" PInstance="0" Index="0" > DType="8"/> > <Property PName="TimeOfLastReset" Value="02/25/2007 22:44:35" PInstance="0" > Index="0" DType="101"/> > <Property PName="DefaultIPGateway:Win32_NetworkAdapterConfiguration" > Value="10.112.14.1" PInstance="0" Index="0" DType="8"/> > <Property PName="DHCPEnabled:Win32_NetworkAdapterConfiguration" > Value="false" PInstance="0" Index="0" DType="11"/> > <Property PName="DNSHostName:Win32_NetworkAdapterConfiguration" > Value="VSSRES001403" PInstance="0" Index="0" DType="8"/> > <Property PName="Index:Win32_NetworkAdapterConfiguration" Value="0" > PInstance="0" Index="0" DType="19"/> > <Property PName="IPAddress:Win32_NetworkAdapterConfiguration" > Value="10.112.14.5" PInstance="0" Index="0" DType="8"/> > <Property PName="IPEnabled:Win32_NetworkAdapterConfiguration" Value="true" > PInstance="0" Index="0" DType="11"/> > <Property PName="IPSubnet:Win32_NetworkAdapterConfiguration" > Value="255.255.255.0" PInstance="0" Index="0" DType="8"/> > <Property PName="MACAddress:Win32_NetworkAdapterConfiguration" > Value="00:90:FB:0B:83:ED" PInstance="0" Index="0" DType="8"/> > <Property PName="ServiceName:Win32_NetworkAdapterConfiguration" > Value="E100B" PInstance="0" Index="0" DType="8"/> > </Class> > > <Class CName="Win32_NetworkAdapter" CInstance="1"> > <Property PName="Description" Value="RAS Async Adapter" PInstance="0" > Index="0" DType="8"/> > <Property PName="Index" Value="1" PInstance="0" Index="0" DType="19"/> > <Property PName="Installed" Value="true" PInstance="0" Index="0" > DType="11"/> > <Property PName="TimeOfLastReset" Value="02/25/2007 22:44:35" PInstance="0" > Index="0" DType="101"/> > <Property PName="DefaultIPGateway:Win32_NetworkAdapterConfiguration" > Value="N/A" PInstance="0" Index="0" DType="8"/> > <Property PName="Description:Win32_NetworkAdapterConfiguration" Value="RAS > Async Adapter" PInstance="0" Index="0" DType="8"/> > <Property PName="DHCPEnabled:Win32_NetworkAdapterConfiguration" > Value="false" PInstance="0" Index="0" DType="11"/> > <Property PName="Index:Win32_NetworkAdapterConfiguration" Value="1" > PInstance="0" Index="0" DType="19"/> > <Property PName="IPAddress:Win32_NetworkAdapterConfiguration" Value="N/A" > PInstance="0" Index="0" DType="8"/> > <Property PName="IPEnabled:Win32_NetworkAdapterConfiguration" Value="false" > PInstance="0" Index="0" DType="11"/> > <Property PName="IPSubnet:Win32_NetworkAdapterConfiguration" Value="N/A" > PInstance="0" Index="0" DType="8"/> > <Property PName="ServiceName:Win32_NetworkAdapterConfiguration" > Value="AsyncMac" PInstance="0" Index="0" DType="8"/> > </Class> > > | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
