From dc820237b1800437a34f17fa826002a67961bbd7 Mon Sep 17 00:00:00 2001 From: Dave Abrahams Date: Fri, 4 Feb 2005 20:18:33 +0000 Subject: [PATCH] Factored out egregious code duplication [SVN r27098] --- v2/tools/xsltproc.jam | 41 ++++++++++++++++++----------------------- 1 file changed, 18 insertions(+), 23 deletions(-) diff --git a/v2/tools/xsltproc.jam b/v2/tools/xsltproc.jam index 9ba7dea27..85aad1495 100644 --- a/v2/tools/xsltproc.jam +++ b/v2/tools/xsltproc.jam @@ -53,36 +53,31 @@ rule compute-xslt-flags ( target : properties * ) } +local rule .xsltproc ( target : source stylesheet : properties * : dirname : action ) +{ + STYLESHEET on $(target) = $(stylesheet) ; + FLAGS on $(target) = [ compute-xslt-flags $(target) : $(properties) ] ; + NAME on $(target) = $(.xsltproc) ; + + for local catalog in [ feature.get-values : $(properties) ] + { + CATALOG = [ common.variable-setting-command XML_CATALOG_FILES : catalog.xml ] ; + } + + DIRECTORY on $(target) = $(dirname) ; + $(action) $(target) : $(source) ; +} + rule xslt ( target : source stylesheet : properties * ) { - STYLESHEET on $(target) = $(stylesheet) ; - FLAGS on $(target) = [ compute-xslt-flags $(target) : $(properties) ] ; - NAME on $(target) = $(.xsltproc) ; - - for local catalog in [ feature.get-values : $(properties) ] - { - CATALOG = [ common.variable-setting-command "XML_CATALOG_FILES" $(catalog) ] ; - } - - xslt-xsltproc $(target) : $(source) ; + return [ .xsltproc $(target) : $(source) $(stylesheet) : $(properties) : : xslt-xsltproc ] ; } rule xslt-dir ( target : source stylesheet : properties * : dirname ) -{ - STYLESHEET on $(target) = $(stylesheet) ; - FLAGS on $(target) = [ compute-xslt-flags $(target) : $(properties) ] ; - DIRECTORY on $(target) = $(dirname) ; - NAME on $(target) = $(.xsltproc) ; - - for local catalog in [ feature.get-values : $(properties) ] - { - CATALOG = [ common.variable-setting-command "XML_CATALOG_FILES" $(catalog) ] ; - } - - xslt-xsltproc-dir $(target) : $(source) ; +{ + return [ .xsltproc $(target) : $(source) $(stylesheet) : $(properties) : $(dirname) : xslt-xsltproc-dir ] ; } - actions xslt-xsltproc { $(CATALOG) "$(NAME:E=xsltproc)" $(FLAGS) --xinclude -o "$(<)" "$(STYLESHEET)" "$(>)"