2
0
mirror of https://github.com/boostorg/build.git synced 2026-02-17 01:32:12 +00:00
Files
build/tools/xsltproc.jam
Vladimir Prus e488765eae Move a bunch of modules to "tools" directory. I'm uncertain about some
modules that are still in "new", but they can be moved later.


[SVN r18692]
2003-06-06 09:38:49 +00:00

87 lines
2.3 KiB
Plaintext

# Copyright (C) 2003 Doug Gregor. Permission to copy, use, modify,
# sell and distribute this software is granted provided this
# copyright notice appears in all copies. This software is provided
# "as is" without express or implied warranty, and with no claim as
# to its suitability for any purpose.
# This module defines rules to apply an XSLT stylesheet to an XML file
# using the xsltproc driver, part of libxslt.
import feature ;
import regex ;
# Initialize xsltproc support. The parameters are:
# xsltproc: The xsltproc executable
rule init ( xsltproc ? )
{
if ! $(xsltproc)
{
xsltproc = [ modules.peek : XSLTPROC ] ;
}
if ! $(.initialized)
{
$(.initialized) = true ;
.xsltproc = $(xsltproc) ;
}
}
rule xslt ( target : source stylesheet : properties * )
{
local flags ;
for local param in [ feature.get-values <xsl:param> : $(properties) ]
{
local namevalue = [ regex.split $(param) "=" ] ;
flags += --stringparam $(namevalue[1]) $(namevalue[2]) ;
}
STYLESHEET on $(target) = $(stylesheet) ;
FLAGS on $(target) = $(flags) ;
NAME on $(target) = $(.xsltproc) ;
xslt-xsltproc $(target) : $(source) ;
}
rule xslt-dir ( target : source stylesheet : properties * : dirname )
{
local flags ;
for local param in [ feature.get-values <xsl:param> : $(properties) ]
{
local namevalue = [ regex.split $(param) "=" ] ;
flags += --stringparam $(namevalue[1]) $(namevalue[2]) ;
}
STYLESHEET on $(target) = $(stylesheet) ;
FLAGS on $(target) = $(flags) ;
DIRECTORY on $(target) = $(dirname) ;
NAME on $(target) = $(.xsltproc) ;
xslt-xsltproc-dir $(target) : $(source) ;
}
if [ modules.peek : NT ]
{
actions xslt-xsltproc
{
set XML_CATALOG_FILES=catalog.xml
$(NAME:E=xsltproc) $(FLAGS) --xinclude -o $(<) $(STYLESHEET) $(>)
}
actions xslt-xsltproc-dir
{
set XML_CATALOG_FILES=catalog.xml
$(NAME:E=xsltproc) $(FLAGS) --xinclude -o $(DIRECTORY)/ $(STYLESHEET) $(>)
}
}
else
{
actions xslt-xsltproc
{
XML_CATALOG_FILES=catalog.xml $(NAME:E=xsltproc) $(FLAGS) --xinclude -o $(<) $(STYLESHEET) $(>)
}
actions xslt-xsltproc-dir
{
XML_CATALOG_FILES=catalog.xml $(NAME:E=xsltproc) $(FLAGS) --xinclude -o $(DIRECTORY)/ $(STYLESHEET) $(>)
}
}
IMPORT $(__name__) : xslt : : xslt ;
IMPORT $(__name__) : xslt-dir : : xslt-dir ;