XML/XSL Replace

webmasterbeta

New Member
Hello all,

I've been working on the following problem for ages and even Google's given me no joy so fingers crossed you can help.

We have two databases and are using XML to send data from one to the other which is working fine (we had a company build an export/import utility). The problem is that when the file is exported from database a, some attribute values need to be changed in order for it to work in database b.

The XML is as follows:

<?xml version="1.0" encoding="UTF-8"?>
<cms schema_version="1.2.1">
<publication cms_id="43" name="Website">
<section cms_id="187" name="Ward Equipment">
<subsection cms_id="708" name="Bedside Lockers">
<item_group cms_id="3390" name="BL/2 RANGE">
<attribute cms_id="1" data_type="2">
<data cms_id="1234" name="My Title" short_name="My Title" language_id="0">
<![CDATA[My Page Content Here]]></data>
</attribute>
<graphic cms_id="1570">
<graphic_type cms_id="5"/>
<file>
<path>path/to/file</path>
<filename>myfilename.jpg</filename>
</file>
</graphic>
</item_group>
</subsection>
</section>
</publication>
</cms>

I've managed to do a find/replace on everything in the <data> node (e.g the page content) but what I actually need to change is <graphic_type cms_id="5"/> to cms_id="101".

The only way I have seen to do this is via javascript but I've been asked to get it working using XSL so that it's all picked up when the file's run through the importer.

And a simple find/replace in a text editor won't work (which I wish it would!) as the cms_id may vary from day to day and the file is over 4GB!

Thanks in advance for your help

Katy
 
Back
Top