2
0
mirror of https://github.com/boostorg/build.git synced 2026-02-16 13:22:11 +00:00
Files
build/tools/xsltproc.jam
Vladimir Prus c348e666d8 BoostBook improvements.
* new/boostbook.jam
  Move xsl:param out of here. Print nice error message when boost root is not
  specified. Don't set TEMPORARY on catalog files, since it prevents catalog
  creation now and catalog is not temparary anyway.
  Export boostbook to global scope to that "using boostbook" works.
  Update dependency scanner for recent changes in build engine.

* new/xsltproc.jam
  New feature xsl:path.
  (compute-xslt-flags): New rule, with factored out common code.
  Use common.variable-setting-command to simplify actions.


[SVN r19028]
2003-07-10 14:13:59 +00:00

88 lines
2.4 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.
#
# Note: except for 'init', this modules does not provide any rules
# for end users.
import feature ;
import regex ;
import common ;
feature.feature xsl:param : : free ;
feature.feature xsl:path : : free ;
# 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 compute-xslt-flags ( target : properties * )
{
local flags ;
# Translate <xsl:param> into command line flags.
for local param in [ feature.get-values <xsl:param> : $(properties) ]
{
local namevalue = [ regex.split $(param) "=" ] ;
flags += --stringparam $(namevalue[1]) $(namevalue[2]) ;
}
# Translate <xsl:path>
for local path in [ feature.get-values <xsl:path> : $(properties) ]
{
flags += --path $(path:G=) ;
}
return $(flags) ;
}
rule xslt ( target : source stylesheet : properties * )
{
STYLESHEET on $(target) = $(stylesheet) ;
FLAGS on $(target) = [ compute-xslt-flags $(target) : $(properties) ] ;
NAME on $(target) = $(.xsltproc) ;
CATALOG = [ common.variable-setting-command "XML_CATALOG_FILES" "catalog.xml" ] ;
xslt-xsltproc $(target) : $(source) ;
}
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) ;
CATALOG = [ common.variable-setting-command "XML_CATALOG_FILES" "catalog.xml" ] ;
xslt-xsltproc-dir $(target) : $(source) ;
}
actions xslt-xsltproc
{
$(CATALOG) $(NAME:E=xsltproc) $(FLAGS) --xinclude -o $(<) $(STYLESHEET) $(>)
}
actions xslt-xsltproc-dir
{
$(CATALOG) $(NAME:E=xsltproc) $(FLAGS) --xinclude -o $(DIRECTORY)/ $(STYLESHEET) $(>)
}
IMPORT $(__name__) : xslt : : xslt ;
IMPORT $(__name__) : xslt-dir : : xslt-dir ;