public static Bibliography makeAdhocBibliography ( String style , String outputFormat , CSLItemData ... items ) throws IOException { ItemDataProvider provider = new ListItemDataProvider ( items ) ; try ( CSL csl = new CSL ( provider , style ) ) { csl . setOutputFormat ( outputFormat ) ; String [ ] ids = new String [ items . length ] ; for ( int i = 0 ; i < items . length ; ++ i ) { ids [ i ] = items [ i ] . getId ( ) ; } csl . registerCitationItems ( ids ) ; return csl . makeBibliography ( ) ; } }
Creates an ad hoc bibliography from the given citation items . Calling this method is rather expensive as it initializes the CSL processor . If you need to create bibliographies multiple times in your application you should create the processor yourself and cache it if necessary .