Как заменить узел в MarkLogic для определенного атрибута? Например, как показано ниже:Замена узла специального атрибута
<chapters>
<title id="primary">first primary content</title>
<title id="primary">second primary content</title>
<title id="secondary">this is amy middle content</title>
<title id="terciary">this is amy last content</title>
</chapters>
Я хочу, чтобы, как показано ниже:
<chapters>
<title id="primary">third primary content</title>
<title id="secondary">this is amy middle content</title>
<title id="terciary">this is amy last content</title>
</chapters>
Я имею в виду предположим A.xml
файл, сохраненный в сервере базы данных MarkLogic, которые содержат данные, такие как bleow:
<chaptermetadata>
<chapters>
<title id="primary">first content</title>
<title id="primary">second content</title>
<title id="secondary">This is middle content</title>
<title id="terciary">This is last content</title>
</chapters>
<chapters>
<title id="primary">fouth content</title>
<title id="primary">fifth content</title>
<title id="primary">sixth content</title>
<title id="secondary">This is new content</title>
<title id="terciary">This is old content</title>
</chapters>
<chaptermetadata>
Теперь я хотите заменить узел во всем элементе title
, который содержит атрибут @id='primary'
во всех главах, как показано ниже:
<chaptermetadata>
<chapters>
<title id="primary">common content</title>
<title id="secondary">This is middle content</title>
<title id="terciary">This is last content</title>
</chapters>
<chapters>
<title id="primary">common content</title>
<title id="secondary">This is new content</title>
<title id="terciary">This is old content</title>
</chapters>
<chaptermetadata>
трудно понять, какое преобразование вы запрашиваете, учитывая разницу между двумя кодовыми блоками –