Hi There, I'm trying to write an XSLT transformation which will replace the value in one node with the value of it's preceding sibling. Then return the entire document transformed :)
Find the occurrences of
<package:packageDownloadLocator>http://myunwantedurl</package:packageDownloadLocator>
and replace with the text value of it's proceeding sibling
<package:packagePreviewLocator>http://myurl.com</package:packagePreviewLocator>
Thanks for any help or suggestions
Note: The node to be found does not always exist in each record.
From this:
<?xml version="1.0"?>
<SRW:searchRetrieveResponse xmlns:SRW="http://www.loc.gov/zing/srw/" xmlns:DIAG="http://www.loc.gov/zing/srw/diagnostics" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:package="info:srw/extension/13/package-v1.0">
<SRW:records>
<SRW:record>
<SRW:recordData>
<dc:dc>
<dc:title xml:lang="en">Opportunities for involvement for service users and carers at the Open University in Scotland</dc:title>
<dc:description xml:lang="en">Booklet explaining the different ways service users or carers can assist</dc:description>
<dc:publisher>Open University</dc:publisher>
<dc:format>application/pdf</dc:format>
<dc:type>Narrative Text</dc:type>
<dc:rights xml:lang="en">Copyright Open University, 2009</dc:rights>
<dc:subject>health and health care, health care, nursing</dc:subject>
</dc:dc>
</SRW:recordData>
<SRW:extraRecordData>
<package:packagePreviewLocator>http://myurl.com</package:packagePreviewLocator>
<package:packageDownloadLocator>http://myunwantedurl</package:packageDownloadLocator>
<record:record xmlns:record="http://srw.o-r-g.org/schemas/rec/1.0/">
<record:lastModified>2009-09-29</record:lastModified>
<record:created>2009-09-29</record:created>
</record:record>
</SRW:extraRecordData>
</SRW:record>
</SRW:records>
</SRW:searchRetrieveResponse>
To this:
<?xml version="1.0"?>
<SRW:searchRetrieveResponse xmlns:SRW="http://www.loc.gov/zing/srw/" xmlns:DIAG="http://www.loc.gov/zing/srw/diagnostics" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:package="info:srw/extension/13/package-v1.0">
<SRW:records>
<SRW:record>
<SRW:recordData>
<dc:dc>
<dc:title xml:lang="en">Opportunities for involvement for service users and carers at the Open University in Scotland</dc:title>
<dc:description xml:lang="en">Booklet explaining the different ways service users or carers can assist</dc:description>
<dc:publisher>Open University</dc:publisher>
<dc:format>application/pdf</dc:format>
<dc:type>Narrative Text</dc:type>
<dc:rights xml:lang="en">Copyright Open University, 2009</dc:rights>
<dc:subject>health and health care, health care, nursing</dc:subject>
</dc:dc>
</SRW:recordData>
<SRW:extraRecordData>
<package:packagePreviewLocator>http://myurl.com</package:packagePreviewLocator>
<package:packageDownloadLocator>http://myurl.com</package:packageDownloadLocator>
<record:record xmlns:record="http://srw.o-r-g.org/schemas/rec/1.0/">
<record:lastModified>2009-09-29</record:lastModified>
<record:created>2009-09-29</record:created>
</record:record>
</SRW:extraRecordData>
</SRW:record>
</SRW:records>
</SRW:searchRetrieveResponse>