Я пытаюсь написать XSLT-преобразование, которое заменит значение в одном узле значением предыдущего брата. Затем верните весь документ в преобразованном виде:)
Найти вхождения
<package:packageDownloadLocator>http://myunwantedurl</package:packageDownloadLocator>
и замените текстовым значением своего исходного брата
<package:packagePreviewLocator>http://myurl.com</package:packagePreviewLocator>
Спасибо за любую помощь или предложения
Примечание. Найденный узел не всегда существует в каждой записи.
Из этого:
<?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>
К этому:
<?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>