I’ve very new to XML and making XSL stylesheets. Currently I have a bunch of Exchange Servers listed throughout my XML document. All the Exchange Servers are located within the node:
within the XML document.
In my XSL stylesheet I’ve been calling out the exchange server individually by name. (example):
As you can see if one has multiple servers the stylesheet will get rather congested calling out each server. I want to know if there is a way that I can display all the Exchange servers by using: contoso.microso f.com instead of inputing each server names entire FQDN individually. I want one rule for all Exchange servers so that I don’t have to make a a rule for each within the atribute for-each select .
Below is my XML document and my XSL Stylesheet.
XML Document (Had to modify this a little because the XML file is huge):
XSLT Stylesheet
Attached is a screenshoot of my XML output table.
Code:
DocItemSet/DocItem/Data/AnchoredXml/Dictionary/Item/Value/Topology/Clusters/Cluster
In my XSL stylesheet I’ve been calling out the exchange server individually by name. (example):
Code:
for-each select="DocItemSet/DocItem/Data/AnchoredXml/Dictionary/Item/Value/Topology/Clusters/Cluster[@Fqdn='exch-dc-08.contoso.microsoft.com'] | DocItemSet/DocItem/Data/AnchoredXml/Dictionary/Item/Value/Topology/Clusters/Cluster[@Fqdn='tk5ucdfpp01.contoso.microsoft.com']”>.
Below is my XML document and my XSL Stylesheet.
XML Document (Had to modify this a little because the XML file is huge):
Code:
<Key ScopeClass="Global">
<SchemaId Namespace="urn:schema:Microsoft.Rtc.Management.Deploy.Topology.2008" ElementName="Topology" />
<AuthorityId Class="Host" InstanceId="00000000-0000-0000-0000-000000000000" />
</Key>
<Dictionary Count="1">
<Item>
<Key />
<Value Signature="d68c994c-9b4c-4bac-8659-7709d1639352">
<Topology xmlns="urn:schema:Microsoft.Rtc.Management.Deploy.Topology.2008" schemaLocation="urn:schema:Microsoft.Rtc.Management.Deploy.Topology.2008 ..\..\..\..\dev\server\Squid\Schemas\Deploy\Topology.2008.xsd">
<InternalDomains AllowAllDomains="false" DefaultDomain="microsoft.com">
<InternalDomain Name="microsoft.com" Authoritative="false" />
</InternalDomains>
<Sites>
<CentralSite SiteId="tk5">
<Name>Exchange</Name>
<Location CountryCode="US" City="Quincy" State="WA" />
</CentralSite>
<CentralSite SiteId="tukwila">
<Name>Tukwila</Name>
<Location CountryCode="US" City="Tukwila" State="WA" />
<SiteConfiguration Type="Microsoft.Rtc.Management.Deploy.Internal.SiteConfigurations.OCSSiteConfiguration">
<OCSSiteConfiguration xmlns="urn:schema:Microsoft.Rtc.Management.Deploy.SiteConfigurations.2008">
<FederationRoute>
<ServiceId xmlns="urn:schema:Microsoft.Rtc.Management.Deploy.Topology.2008" SiteId="BackCompatSite" RoleName="Registrar" Instance="7" />
</FederationRoute>
</OCSSiteConfiguration>
</SiteConfiguration>
</CentralSite>
<CentralSite SiteId="BackCompatSite">
<Name>BackCompatSite</Name>
</CentralSite>
<RemoteSite SiteId="bo_tc" CentralSiteId="tk5">
<Name>Tacoma Branch</Name>
<Location CountryCode="US" City="Tacoma" State="WA" />
</RemoteSite>
</Sites>
<Clusters>
<Cluster Fqdn="exch-dc-08.contoso.microsoft.com" RequiresReplication="false" RequiresSetup="false">
<ClusterId SiteId="tk5" Number="1" />
<Machine OrdinalInCluster="1" Fqdn="exch-dc-08.contoso.microsoft.com">
<NetInterface InterfaceSide="Primary" InterfaceNumber="1" IPAddress="1.1.1.1" />
</Machine>
</Cluster>
<Cluster Fqdn="tk5ucdfpp01.contoso.microsoft.com" RequiresReplication="false" RequiresSetup="false">
<ClusterId SiteId="tk5" Number="2" />
<Machine OrdinalInCluster="1" Fqdn="tk5ucdfpp01.contoso.microsoft.com">
<NetInterface InterfaceSide="External" InterfaceNumber="1" IPAddress="2.2.2.2" />
<NetInterface InterfaceSide="Primary" InterfaceNumber="1" IPAddress="2.2.2.2" />
</Machine>
</Cluster>
<Cluster Fqdn="b43ucdfms01.contoso.microsoft.com" RequiresReplication="false" RequiresSetup="false">
<ClusterId SiteId="tk5" Number="3" />
<Machine OrdinalInCluster="1" Fqdn="b43ucdfms01.contoso.microsoft.com">
<NetInterface InterfaceSide="Primary" InterfaceNumber="1" IPAddress="3.3.3.3" />
<NetInterface InterfaceSide="Pstn" InterfaceNumber="1" IPAddress="3.3.3.3" />
</Machine>
</Cluster>
+ <SqlInstances>
+ <Services>
</Topology>
</Value>
</Item>
</Dictionary>
</AnchoredXml>
</Data>
</DocItem>
+ <DocItem Name>
</DocItemSet>
Code:
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<xsl:template match="/">
<html>
<body>
<body bgcolor="Silver">
</body>
<h2>Exchange Server Information</h2>
<table border="3">
<tr bgcolor="yellow">
<th>Exchange Servers</th>
<th>Replication Required</th>
<th>Setup Required</th>
<th>Network Interface</th>
<th>IP Address</th>
</tr>
<xsl:for-each select="DocItemSet/DocItem/Data/AnchoredXml/Dictionary/Item/Value/Topology/Clusters/Cluster[@Fqdn='exch-dc-08.contoso.microsoft.com']|
DocItemSet/DocItem/Data/AnchoredXml/Dictionary/Item/Value/Topology/Clusters/Cluster[@Fqdn='tk5ucdfpp01.contoso.microsoft.com']|
DocItemSet/DocItem/Data/AnchoredXml/Dictionary/Item/Value/Topology/Clusters/Cluster[@Fqdn='b43ucdfms01.contoso.microsoft.com']|
DocItemSet/DocItem/Data/AnchoredXml/Dictionary/Item/Value/Topology/Clusters/Cluster/Machine/NetInterface[@IPAddress='1.1.1.1']|
DocItemSet/DocItem/Data/AnchoredXml/Dictionary/Item/Value/Topology/Clusters/Cluster/Machine/NetInterface[@IPAddress='2.2.2.2']|
DocItemSet/DocItem/Data/AnchoredXml/Dictionary/Item/Value/Topology/Clusters/Cluster/Machine/NetInterface[@IPAddress='3.3.3.3']">
<tr>
<td><xsl:value-of select="@Fqdn"/></td>
<td><xsl:value-of select="@RequiresReplication"/></td>
<td><xsl:value-of select="@RequiresSetup"/></td>
<td><xsl:value-of select="@InterfaceSide"/></td>
<td><xsl:value-of select="@IPAddress"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
Comment