Suppose I have the following code:
\documentclass{article}
\usepackage[backend=biber,bibencoding=utf8]{biblatex}
\usepackage{filecontents}
\begin{filecontents}{test.bib}
@online {page1,
crossref = "mysite",
title = "Page 1",
url = "http://www.example.com/page1.html"
}
@online {page2,
crossref = "mysite",
title = "Page 2",
url = "http://www.example.com/page2.html"
}
@online {mysite,
title = "My Website Home",
author = "John Doe",
date = "2016-01-01",
url = "http://www.example.com/",
organization = "My Website"
}
\end{filecontents}
\addbibresource{test.bib}
\begin{document}
\cite{mysite}, \cite{page1}, \cite{page2}.
\printbibliography
\end{document}
As you can see, I have two webpages, page1 and page2 which are crossref'd from the entry mysite. This is nice, but unfortunately it requires me to copy the URL each time I add a new page. Now, for such a trivial example, it isn't too much of a hassle, but it's a pain for large bibliographies, and can be error prone. I set about trying to figure out a way to fix this. First, I added the following mapping code to the header:
...
\DeclareDriverSourcemap{
\map[overwrite]{
\pertype{online}
\step[fieldsource=webpage]
\step[fieldset=url, origfieldval, append]
}
}
...
Then, I modified the two entries which reference mysite like so:
...
@online {page1,
crossref = "mysite",
title = "Page 1",
webpage = "page1.html"
}
@online {page2,
crossref = "mysite",
title = "Page 2",
webpage = "page2.html"
}
...
Unfortunately, this doesn't work. While it does put the contents of the webpage field into the url field, it does not append the content of the former to the inherited URL. I'm at a loss as to what the matter is. Is there some way to make BibLaTeX use inherited values when doing maps?
.bibfile. While inheritance comes later. So when your sourcemap is executed inheritance has not taken place. – moewe Sep 20 '16 at 07:32urlshould contain anurl. Why don't you change the macros so that the url is printed asurl+webpage? – Ulrike Fischer Sep 20 '16 at 08:32@string{mywww = "http://www.example.com"}and thenurl = mywwwin the entries. Your sourcemapping would work fine then. – jon Sep 20 '16 at 13:39\DeclareFieldFormatcommand? – junius Sep 20 '16 at 14:07