# Include this Makefile to include the following rules.
# Before inclusion, set the XML2HTML variable to be the path to this directory.
#XML2HTML=.

%.xhtml: %.xml
	rm -f $@ $@.tmp
	$(XSLTPROC) --stringparam document-id $$PWD/$< $(XML2HTML)/structure.xslt $< >$@.tmp && mv $@.tmp $@
%.html: %.xhtml	
	rm -f $@ $@.tmp
	$(XSLTPROC) $(XML2HTML)/identity-html.xslt $< >$@.tmp && mv $@.tmp $@
%.aux: %.xml
	rm -f $@ $(@:=.tmp)
	$(XSLTPROC) --stringparam document-id $$PWD/$< \
	  --stringparam target aux \
	  $(XML2HTML)/structure.xslt $< >$@.tmp && mv $@.tmp $@
	printf '\\bibstyle{unsrthtml}\n' >>$@
%.bbl: %.aux
	BSTINPUTS=$(STYLE) bibtex $<
	sed -f $(STYLE)/detex.sed -e '1s+<dl>+<dl xmlns="http://www.w3.org/1999/xhtml">+' $@ >$@.tmp
	mv $@.tmp $@