in reply to Problem in String Replacement
I wrapped the XML chunk into ce:bib, your root element might have a different name. Also do not forget to change the namespace URI.open 930168.xml ; register-namespace ce 'http://put-your-namespace-URI-here' ; for /ce:bib/ce:bib-reference/ce:other-ref/ce:textref { my $label = substring-before(.,'),') ; if ($label and xsh:matches($label,'\d{4}$')) { insert element ce:label prepend ../.. ; insert text concat($label, ')') into ../../ce:label[1] ; } } save :b ;
|
|---|