Editing Biblatex BibliographyDriver @online: using \iffieldundef and using different languages

I just started using LaTeX some weeks ago and I'm getting better and better. But now as I try to make up my own .bbx style for biblatex I'm at a point where I'm stuck: I'm having trouble editing the online Driver for the bibliography to fit my needs. I want to mention, if the article I found online also was published in a book or journal.

This is how I got so far:

 \DeclareBibliographyDriver{online}{%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\usebibmacro{author/editor+others/translator+others}%
\setunit{\labelnamepunct}\newblock
\usebibmacro{title}%
\newunit
\printlist{language}%
\newunit\newblock
\usebibmacro{url+urldate}%
\iffieldundef{crossref}{}{\usebibmacro{in:}}%
\usebibmacro{bybookauthor}%
\usebibmacro{byeditor+others}%
\usebibmacro{maintitle+booktitle}%
\newunit\newblock
\usebibmacro{journal+issuetitle}%
\printfield{edition}%
\newunit\newblock
\printfield{note}%
\newunit\newblock
\usebibmacro{publisher+location+date}%
\newunit\newblock
\usebibmacro{chapter+pages}%
\newunit\newblock
\iftoggle{bbx:isbn}
{\printfield{isbn}}
{}%
\newunit\newblock
\printfield{doi}%
\newunit\newblock
\printfield{eprint}%
\usebibmacro{finentry}}


As you see I tried working with \iffieldundef{crossref}, so that whenever the field{crossref} is defined the bibmacro{in:} is shown and left out if the field is not defined. But with the definition above it doesn't print “In:” at all!

Also I would like to modify the text that is printed by bibmacro{in:}. For example if field{crossref} is defined using english:

   Huber, Gerald (2013): Having trouble with biblatex. www.goforlatex.com.
[Visited on 02/19/2013] **Also in**: Jacobs, Daniel (ed.) (2013):
Solvingall the biblatex problems. Vienna: Latex University Press, pp. 1-999.


on the other hand using german:

   Huber, Gerald (2013): Having trouble with biblatex. www.goforlatex.com.
[Besucht am 19.2.2013] **Auch in**: Jacobs, Daniel (ed.) (2013): Solving all
the biblatex problems. Vienna: Latex University Press, S. 1-999.


No field{crossref} should simply result in:

   Huber, Gerald (2013): Having trouble with biblatex. www.goforlatex.com.
[Visited on 02/19/2013]


So on the one hand I need to make the bibmacro{in:} dependent on the field{crossref} and modify it to show “Also in:” when using english or “Auch in:” when using german.

I don't know wheter or not it was a good idea trying to solve the first problem with \iffieldundef and concerning the language problem, I have no idea where to start. So I'm reaching out for your help, big cyberspace-(bib)latex-community.

Here I have an example of what I have so far:

\documentclass[a4paper,12pt]{scrreprt}

\usepackage[ngerman]{babel}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[babel]{csquotes}

%%%bibliography entries
\begin{filecontents}{literatur.bib}

@online{huber.12o,%
author = {1 Crossref},
title = {Having trouble with biblatex},
year = {2013},
url = {www.goforlatex.com},
urldate = {2013-02-19},
crossref = {huber.12},
}

@article{huber.12,%
author = {1 Crossref},
title = {Having trouble with biblatex},
year = {2013},
journal = {The Great Biblatex Journal},
volume = {3},
number = {11},
pages = {1-999},
}

@online{huber.13o,%
author = {2 Crossref},
title = {Having trouble with biblatex},
year = {2013},
url = {www.goforlatex.com},
urldate = {2013-02-19},
crossref = {huber.13},
}

@inbook{huber.13,%
crossref = {jacobs.13},
title = {Having trouble with biblatex},
author = {2 crossref},
pages = {1--999},
year = {2013},
}

@book{jacobs.13,%
editor = {Daniel Jacobs},
year = {2013},
publisher = {Latex University Press},
title = {Solving all the Latex problems},
edition = {5}
}

@online{nocrossref,%
author = {Crossref No},
title = {Some articles are just available in the www},
url = {www.whereisthecross.com},
urldate = {2013-02-19},
year = {2013},
}
\end{filecontents}

\usepackage[citestyle=authoryear,bibstyle=authoryear,sorting=nyt,maxbibnames=3,bibencoding=utf8,backend=biber]{biblatex}

%%% here is where it gets interesting...
\DeclareBibliographyDriver{online}{%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\usebibmacro{author/editor+others/translator+others}%
\setunit{\labelnamepunct}\newblock
\usebibmacro{title}%
\newunit
\printlist{language}%
\newunit\newblock
\usebibmacro{url+urldate}%
\iffieldundef{crossref}{}{\usebibmacro{in:}}%
\usebibmacro{bybookauthor}%
\usebibmacro{byeditor+others}%
\usebibmacro{maintitle+booktitle}%
\newunit\newblock
\usebibmacro{journal+issuetitle}%
\printfield{edition}%
\newunit\newblock
\printfield{note}%
\newunit\newblock
\usebibmacro{publisher+location+date}%
\newunit\newblock
\usebibmacro{chapter+pages}%
\newunit\newblock
\iftoggle{bbx:isbn}
{\printfield{isbn}}
{}%
\newunit\newblock
\printfield{doi}%
\newunit\newblock
\printfield{eprint}%
\usebibmacro{finentry}}

\bibliography{literatur.bib}

\begin{document}

\nocite{huber.12o}
\nocite{huber.13o}
\nocite{nocrossref}

\printbibliography

\end{document}


Hope someone can help me out, any hint is appreciated...

-
Welcome to TeX.sx! Usually, we don't put a greeting or a "thank you" in our posts. While this might seem strange at first, it is not a sign of lack of politeness, but rather part of our trying to keep everything very concise. Upvoting is the preferred way here to say "thank you" to users who helped you. –  Guido Feb 19 '13 at 20:27

The crossref field can be thought of as a pointer to the parent entry in the bbl file. If the parent entry doesn't meet the mincrossrefs threshold for inclusion into bbl, the child's crossref field will be undefined. To get around this you can load biblatex with mincrossrefs=1, but you will likely need to filter out uncited parent entries from the bibliography.

The biber-only related entries feature introduced by biblatex 2.0/biber 1.0 avoids this complication. Cross-referenced entries are listed in the related field. The key given in the relatedtype field specifies the delimiting string and bibliography macro used to set the related entry data. Related entries appear in the bibliography only if they are cited directly.

Here's an example that also demonstrates how you can define new bibliography strings in the preamble. If you are creating a style you may wish to define your own localization files for English and German. These can be easily defined on top of the standard modules english.lbx and german.lbx. See austrian.lbx for an example and the biblatex manual for further details.

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[american]{babel}
\usepackage{csquotes}
\usepackage[backend=biber]{biblatex}

\NewBibliographyString{alsoin}
\DefineBibliographyStrings{english}{alsoin = {also in}}
\DefineBibliographyStrings{german}{alsoin = {auch in}}

\newbibmacro*{related:alsoin}[1]{%
\entrydata*{#1}{%
\usedriver
{\renewbibmacro{in:}{}%
\ifnamesequal{author}{savedauthor}{\clearname{author}}{}%
\iffieldsequal{title}{savedtitle}{\clearfield{title}}{}}
{\thefield{entrytype}}}}

\begin{filecontents}{\jobname.bib}
@article{kasher/toc,
author = {Roy Kasher and Julia Kempe},
title = {Two-Source Extractors Secure Against Quantum Adversaries},
year = {2012},
pages = {461-486},
doi = {10.4086/toc.2012.v008a021},
journal = {Theory of Computing},
volume = {8},
number = {1}}
@online{kasher/arxiv,
author = {Kasher, Roy and Kempe, Julia},
title = {Two-Source Extractors Secure Against Quantum Adversaries},
eprinttype = {arxiv},
eprintclass = {quant-ph},
eprint = {1005.0512},
month = may,
year = {2010},
related = {approx13,kasher/toc},
relatedtype = {alsoin}}
@proceedings{approx13,
editor = {Serna, Maria and Shaltiel, Ronen and Jansen, Klaus and Rolim, Jos{\'e}},
title = {Proceedings of the 13th international conference on Approximation,
and the 14th International conference on Randomization, and combinatorial
optimization: algorithms and techniques},
series = {APPROX/RANDOM'10},
year = {2010},
venue = {Barcelona, Spain},
publisher = {Springer-Verlag},
location = {Berlin, Heidelberg}}
\end{filecontents}