Welcome to WebmasterWorld Guest from 184.108.40.206
Forum Moderators: httpwebwitch
The xml file has the following structure,
The xml file outputs anything between 1 and 30 odd <software> nodes every three minutes with individual static ip addresses dependent on whether the workstation at that ip has had recent activity.
I want to query this xml file and check against a known list of ip addresses with the xsl file and output a new html list of ip's that represent free workstations.
I have managed to sort of do this by writing the following
<xsl: if test="not(contains(ip,'172.AA.AA.AAA'))">workstation A free</xsl: if>
except it runs down the entire <loggedin> list and checks each ip and outputs the text,
so if there were 9 <software> nodes, it writes "workstation A free" 9 times....
I need to write something that checks the <loggedin> tree and queries
...if within this list there is no instance of ip 'x' output this text 'yyy'
and repeats this query for all of the known workstations ip's so I get a single list of free stations.
This seems to me like a poor candidate for XSLT
you could do the same thing much more easily using a server-side script to parse the XML into an array of IPs, then compare that array against another array of known IP addresses.
array A = parsed from XML
array B = your list of known IPs
for each B as B[i],
- if B[i] is not in A,
- - add B[i] to array C
Then if you like you can output the results as XML for transformation into your HTML. Or just have your script output HTML instead.
Doing it that way is more efficient and scalable... easier to maintain, too. your CPU will thank you
all of the xsl processing is being done on reasonably high end machines and is not a constantly refreshing process,
found using keys worked to do it in xsl,
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:key match="/loggedin/software/ip" use="text()" name="list"/>