Trying to load two XML files using XSLT

Here should go questions about transforming XML with XSLT and FOP.
talnw
Posts: 1
Joined: Thu Apr 04, 2019 5:14 pm

Trying to load two XML files using XSLT

Post by talnw »

Hi,

Firstly I must say I'm not a great coder, but I'm here to learn.
The issue I have is I'm not sure how to load different XML files using XSL.

Current setup, after doing some reading.

XML File:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="information.xsl"?>
<list>
<CL file="branches.xml"/>
<CL file="Services.xml"/>
</list>
The XSL file I have at the moment;

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">

<html>
<body>
<!-- Branch Information -->
<table border="0" cellpadding="5">
<tr bgcolor="#9acd32">
<th>Branch Letter</th>
<th>Branch Name</th>
</tr>
<xsl:for-each select="node/branch">
<tr>
<td><xsl:value-of select="branch_letter"/></td>
<td><xsl:value-of select="branch_name"/></td>
</tr>
</xsl:for-each>
</table>

<!-- Service Information -->
<table border="0" cellpadding="5">
<tr bgcolor="#9acd32">
<th>Branch</th>
<th>Port</th>
<th>Debug</th>
<th>Target / IP Address</th>
<th>Assignment / User</th>
</tr>
<xsl:for-each select="/node/service">
<tr>
<td><xsl:value-of select="branch"/></td>
<td><xsl:value-of select="port"/></td>
<td><xsl:value-of select="debug"/></td>
<td><xsl:value-of select="target"/></td>
<td><xsl:value-of select="command"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
If I just use the one xml file, for instance branch.xml below, it loads all the information, using the XSL file.

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="Classic_branches.xsl"?>
<node>
Server-Node
<branch>
<branch_letter>B</branch_letter>
<branch_name>Branch Name</branch_name>
<cli_mas>Branch File 1</cli_mas>
<cli_mas_size>0.30MB</cli_mas_size>
<pol_mas>Branch File 2</pol_mas>
<pol_mas_size>0.35MB</pol_mas_size>
<his_mas>Branch File 3</his_mas>
<his_mas_size>0.35MB</his_mas_size>
<ris_mas>Branch File 4</ris_mas>
<ris_mas_size>0.35MB</ris_mas_size>
<sta_mas>Branch File 5</sta_mas>
<sta_mas_size>25.41MB</sta_mas_size>
</branch>
</node>
So using the XSL file, I want to know how I get can it to read / load the below XML file;

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="Classic_branches.xsl"?>
<node>
Server Node
<service>
<branch>A</branch>
<port>port 1</port>
<debug>N</debug>
<target>xxx.xxx.xxx.xxx</target>
<command>comand_file | user_name</command>
</service>
<service>
<branch>B</branch>
<port>Port 2</port>
<debug>N</debug>
<target>aaa.aaa.aaa.aaa</target>
<command>command_file | user_name</command>
</service>
I'm hoping someone can point me in the right direction, but in the mean time I'll be on www3 schools website, amongst other material I'm finding / reading on the next. Thanks!