⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 xsltproc.jam

📁 boost库提供标准的C++ API 配合dev c++使用,功能更加强大
💻 JAM
字号:
#  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 ;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -