XML question.

Status
Not open for further replies.
I'm not that good with XML, so hopefully someone can put me down the correct path....

My current XML:
Code:
<dfs>
	<replication>
		<group name="Accounting" folder="D:\DFSRoots\Accounting" membershipstatus="Enabled" stagingquota="8.00 GB">
			<connection>
				<sendingmember>data1</sendingmember>
				<sendingsite>data2</sendingsite>
				<connectionstatus>Enabled</connectionstatus>
				<connectionstatus>data4</connectionstatus>
				<receivingsite>data2</receivingsite>
				<schedule>Replication Group Schedule</schedule>
			</connection>
			<connection>
				<sendingmember>data1 </sendingmember>
				<sendingsite>data2</sendingsite>
				<connectionstatus>Enabled</connectionstatus>
				<connectionstatus>midmain</connectionstatus>
				<receivingsite>data3</receivingsite>
				<schedule>Custom Connection Schedule</schedule>
			</connection>
		</group>
		<group name="Executive" folder="D:\DFSRoots\Executive" membershipstatus="Enabled" stagingquota="8.00 GB">
			<connection>
				<sendingmember>data1 </sendingmember>
				<sendingsite>data2</sendingsite>
				<connectionstatus>Enabled</connectionstatus>
				<connectionstatus>data4</connectionstatus>
				<receivingsite>data2</receivingsite>
				<schedule>Replication Group Schedule2</schedule>
			</connection>
		</group>
	</replication
</dfs>

My current xsl:
Code:
<xsl:if test="computer/dfs/replication/group">
	<xsl:for-each select ="computer/dfs/replication/group" >
		<b>Name: </b><xsl:value-of select = "@name" /><br />
		<b>Folder: </b><xsl:value-of select = "@folder" /><br />
		<b>Membership Status: </b><xsl:value-of select = "@membershipstatus" /><br />
		<table>
			<tr>
			<th>Sending Member</th>
			<th>Sending Site</th>
			<th>Connection Status</th>
			<th>Receiving Member</th>
			<th>Receiving Site</th>
			<th>Schedule</th>
			</tr>
			<xsl:for-each select ="/computer/dfs/replication/group/connection" >
			<tr>
				<td><xsl:value-of select = "sendingmember"/></td>
				<td><xsl:value-of select = "sendingsite"/></td>
				<td><xsl:value-of select = "connectionstatus"/></td>
				<td><xsl:value-of select = "receivingmember"/></td>
				<td><xsl:value-of select = "receivingsite"/></td>
				<td><xsl:value-of select = "schedule"/></td>
			</tr>
			</xsl:for-each>
		</table>
	</xsl:for-each>
</xsl:if>

What it's doing:
Code:
Name: Accounting
Folder: D :\DFSRoots\Accounting
Membership Status: Enabled
Sending Member Sending Site Connection Status Receiving Member Receiving Site Schedule 
data1          data2        Enabled           data2            Replication Group Schedule 
data1          data2        Enabled           data3            Custom Connection Schedule 
data1          data2        Enabled           data2            Replication Group Schedule2 
Name: Executive
Folder: D :\DFSRoots\Executive
Membership Status: Enabled
Sending Member Sending Site Connection Status Receiving Member Receiving Site Schedule 
data1          data2        Enabled           data2            Replication Group Schedule 
data1          data2        Enabled           data3            Custom Connection Schedule 
data1          data2        Enabled           data2            Replication Group Schedule2

What I want it to be doing:
Code:
Name: Accounting
Folder: D :\DFSRoots\Accounting
Membership Status: Enabled
Sending Member Sending Site Connection Status Receiving Member Receiving Site Schedule 
data1          data2        Enabled           data2            Replication Group Schedule 
data1          data2        Enabled           data3            Custom Connection Schedule 

Name: Executive
Folder: D :\DFSRoots\Executive
Membership Status: Enabled
Sending Member Sending Site Connection Status Receiving Member Receiving Site Schedule 
data1          data2        Enabled           data2            Replication Group Schedule2

I don't know how to get my inner for loop (<xsl:for-each select ="/computer/dfs/replication/group/connection" >) to only grab the connection info for it's master group. Any suggestions on how to do this?

Thanks.
 

Caelestian

Ars Centurion
236
Subscriptor++
jbest":2ezzq3zt said:
I'm not that good with XML, so hopefully someone can put me down the correct path....

My current XML:
Code:
			<xsl:for-each select ="/computer/dfs/replication/group/connection" >

I think you want a relative XPath here not an absolute ( the starting slash is making it reference the root of your document instead of your current context).

Code:
			<xsl:for-each select ="connection" >
 
Status
Not open for further replies.