In my .htm file I have this:
<xml id="staff_data" src=http://www.webdeveloper.com/forum/archive/index.php/"test.xml"></xml>
<div name="table1">
<span datasrc="#staff_data" datafld="employee"></span>
</div>
<div name="table2">
<span datasrc="#staff_data" datafld="department"></span>
</div>
My external .xml file looks like this:
<?xml version="1.0" ?>
<staff>
<employee>
John
</employee>
<department>
Marketing
</department>
</staff>
Question 1:
I want to reuse the data from datasrc="#staff_data" later on in the document, but I don't want to repeat datasrc="#staff_data" every single time. Is there a way to avoid this? I've tried to put datasrc="#staff_data" in the <body> tag, but it doesn't work.
Question 2:
If I have understood it correctly, I can present the xml data in two ways:
Alt. 1:
<div>
<span datasrc="#staff_data" datafld="first"></span>
</div>
or
Alt. 2:
<div datasrc="#staff_data" datafld="first">
</div>
Is there an easier way to do this, e.g. using a method similar to PHP?
For instance:
<div>
<?xml print $employee ?>
</div>
As you've probably understood by now I am very new to XML. In other words, your help would be greatly appreciated.
Best regards
<xml id="staff_data" src=http://www.webdeveloper.com/forum/archive/index.php/"test.xml"></xml>
<div name="table1">
<span datasrc="#staff_data" datafld="employee"></span>
</div>
<div name="table2">
<span datasrc="#staff_data" datafld="department"></span>
</div>
My external .xml file looks like this:
<?xml version="1.0" ?>
<staff>
<employee>
John
</employee>
<department>
Marketing
</department>
</staff>
Question 1:
I want to reuse the data from datasrc="#staff_data" later on in the document, but I don't want to repeat datasrc="#staff_data" every single time. Is there a way to avoid this? I've tried to put datasrc="#staff_data" in the <body> tag, but it doesn't work.
Question 2:
If I have understood it correctly, I can present the xml data in two ways:
Alt. 1:
<div>
<span datasrc="#staff_data" datafld="first"></span>
</div>
or
Alt. 2:
<div datasrc="#staff_data" datafld="first">
</div>
Is there an easier way to do this, e.g. using a method similar to PHP?
For instance:
<div>
<?xml print $employee ?>
</div>
As you've probably understood by now I am very new to XML. In other words, your help would be greatly appreciated.
Best regards